From edca62d2fb1c4824aaaa07d56c799e8ff7f0c1ba Mon Sep 17 00:00:00 2001 From: LEDfan Date: Sun, 17 Jan 2016 11:18:41 +0100 Subject: More unit and integration tests --- tests/integration/db/StanzaMapperTest.php | 58 +++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 tests/integration/db/StanzaMapperTest.php (limited to 'tests/integration') diff --git a/tests/integration/db/StanzaMapperTest.php b/tests/integration/db/StanzaMapperTest.php new file mode 100644 index 0000000..22ca394 --- /dev/null +++ b/tests/integration/db/StanzaMapperTest.php @@ -0,0 +1,58 @@ +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()); + } + + + +} \ No newline at end of file -- cgit v1.2.3