Welcome to mirror list, hosted at ThFree Co, Russian Federation.

StanzaMapperTest.php « db « integration « tests - github.com/nextcloud/jsxc.nextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 22ca3949146aaab2922cafc1cfa814fa84a46b14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php

namespace OCA\OJSXC\Db;

use OCA\OJSXC\Utility\MapperTestUtility;

/**
 * @group DB
 */
class StanzaMapperTest extends MapperTestUtility {

	/**
	 * @var StanzaMapper
	 */
	protected $mapper;

	protected function setUp() {
		$this->entityName = 'OCA\OJSXC\Db\Stanza';
		$this->mapperName = 'StanzaMapper';
		parent::setUp();
	}

	public function insertProvider() {
		return [
			[
				'john@localhost',
				'thomas@localhost',
				'abcd'
			]
		];
	}
	
	/**
	 * @dataProvider insertProvider
	 */
	public function testInsert($from, $to, $data) {
		$stanza = new Stanza();
		$stanza->setFrom($from);
		$stanza->setTo($to);
		$stanza->setStanza($data);

		$this->assertEquals($stanza->getFrom(), $from);
		$this->assertEquals($stanza->getTo(), $to);
		$this->assertEquals($stanza->getStanza(), $data);

		$this->mapper->insert($stanza);

		$result = $this->fetchAll();

		$this->assertCount(1, $result);
		$this->assertEquals($stanza->getFrom(), $result[0]->getFrom());
		$this->assertEquals($stanza->getTo(),  $result[0]->getTo());
		$this->assertEquals($stanza->getStanza(),  $result[0]->getStanza());
	}



}