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

github.com/nextcloud/jsxc.nextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLEDfan <tobia@ledfan.be>2016-01-17 13:18:41 +0300
committerLEDfan <tobia@ledfan.be>2016-01-17 13:18:41 +0300
commitedca62d2fb1c4824aaaa07d56c799e8ff7f0c1ba (patch)
treee80c96bc80e83f7b9d59727543a52869c220ce4a /tests/integration
parente9c2976d2af317f25c7945ba84d74519318f72f5 (diff)
More unit and integration tests
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/db/StanzaMapperTest.php58
1 files changed, 58 insertions, 0 deletions
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 @@
+<?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());
+ }
+
+
+
+} \ No newline at end of file