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:
authorTobia De Koninck <LEDfan@users.noreply.github.com>2018-08-27 12:13:58 +0300
committerTobia De Koninck <LEDfan@users.noreply.github.com>2018-08-27 12:13:58 +0300
commit5fda889853222948a070a3a73f1f893ce22f31f0 (patch)
treea1982dde114b163aef7d9b54b3460c8cf2d0e3b9 /tests/integration
parent9f342ec4455ad67f9960a152f28894dc22bd3490 (diff)
Refactor UserId handling to use NC UserId in DB
Originally plan was to use the OJSXC_UserId everywhere because this seemed to be the easiest solution. However in the DB this introduced jsxc/jsxc#708, so now the NC UserId is used everywhere except for XML strings and Stanzas which are received or going to be send. Signed-off-by: Tobia De Koninck <LEDfan@users.noreply.github.com>
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/db/IqRosterPushTest.php2
-rw-r--r--tests/integration/db/IqRosterTest.php2
-rw-r--r--tests/integration/db/MessageMapperTest.php16
-rw-r--r--tests/integration/db/PresenceTest.php8
-rw-r--r--tests/integration/db/StanzaMapperTest.php12
5 files changed, 20 insertions, 20 deletions
diff --git a/tests/integration/db/IqRosterPushTest.php b/tests/integration/db/IqRosterPushTest.php
index 7be4278..a33a26b 100644
--- a/tests/integration/db/IqRosterPushTest.php
+++ b/tests/integration/db/IqRosterPushTest.php
@@ -22,7 +22,7 @@ class IqRosterPushTest extends TestCase
$iqRosterPush->setSubscription('both');
$this->assertEquals('john@localhost', $iqRosterPush->getJid());
- $this->assertEquals('jan@localhost', $iqRosterPush->getTo());
+ $this->assertEquals('jan@localhost', $iqRosterPush->getUnSanitizedTo());
$this->assertEquals('john', $iqRosterPush->getName());
$this->assertEquals('both', $iqRosterPush->getSubscription());
diff --git a/tests/integration/db/IqRosterTest.php b/tests/integration/db/IqRosterTest.php
index 0ecb4dc..a53686e 100644
--- a/tests/integration/db/IqRosterTest.php
+++ b/tests/integration/db/IqRosterTest.php
@@ -23,7 +23,7 @@ class IqRosterTest extends TestCase
$iqRoster->addItem('test2@test.be', 'Test2 Test');
$this->assertEquals('result', $iqRoster->getType());
- $this->assertEquals('john@localhost', $iqRoster->getTo());
+ $this->assertEquals('john@localhost', $iqRoster->getUnSanitizedTo());
$this->assertEquals(4434, $iqRoster->getQid());
$this->assertEquals([
[
diff --git a/tests/integration/db/MessageMapperTest.php b/tests/integration/db/MessageMapperTest.php
index cae3602..41d45ad 100644
--- a/tests/integration/db/MessageMapperTest.php
+++ b/tests/integration/db/MessageMapperTest.php
@@ -57,8 +57,8 @@ class MessageMapperTest extends MapperTestUtility
$stanza->setType($type);
$stanza->setValue($msg);
- $this->assertEquals($stanza->getFrom(), $from[0]);
- $this->assertEquals($stanza->getTo(), $to[0]);
+ $this->assertEquals($stanza->getUnSanitizedFrom(), $from[0]);
+ $this->assertEquals($stanza->getUnSanitizedTo(), $to[0]);
$this->assertEquals($stanza->getStanza(), $data);
$this->assertEquals($stanza->getType(), $type);
@@ -67,8 +67,8 @@ class MessageMapperTest extends MapperTestUtility
$result = $this->fetchAll();
$this->assertCount(1, $result);
- $this->assertEquals($stanza->getFrom(), $result[0]->getFrom());
- $this->assertEquals($stanza->getTo(), $result[0]->getTo());
+ $this->assertEquals($stanza->getUnSanitizedFrom(), $result[0]->getFrom());
+ $this->assertEquals($stanza->getUnSanitizedTo(), $result[0]->getTo());
$this->assertEquals($expectedStanza, $result[0]->getStanza());
$this->assertEquals(null, $result[0]->getType()); // type is saved into the XML string, not the DB.
}
@@ -128,8 +128,8 @@ class MessageMapperTest extends MapperTestUtility
// check if element is deleted
$result = $this->fetchAll();
$this->assertCount(1, $result);
- $this->assertEquals($stanza2->getFrom(), $result[0]->getFrom());
- $this->assertEquals($stanza2->getTo(), $result[0]->getTo());
+ $this->assertEquals($stanza2->getUnSanitizedFrom(), $result[0]->getFrom());
+ $this->assertEquals($stanza2->getUnSanitizedTo(), $result[0]->getTo());
$this->assertEquals('<message to="jan" from="thomas" type="test2" xmlns="jabber:client" id="4-msg">Message</message>', $result[0]->getStanza()); // notice that the username isn't replaced by the JID since this tis the task of hte findByTo method
}
@@ -166,8 +166,8 @@ class MessageMapperTest extends MapperTestUtility
// check if element is deleted
$result = $this->fetchAll();
$this->assertCount(1, $result);
- $this->assertEquals($stanza2->getFrom(), $result[0]->getFrom());
- $this->assertEquals($stanza2->getTo(), $result[0]->getTo());
+ $this->assertEquals($stanza2->getUnSanitizedFrom(), $result[0]->getFrom());
+ $this->assertEquals($stanza2->getUnSanitizedTo(), $result[0]->getTo());
$this->assertEquals('<message to="jan_ojsxc_esc_at_localhost.com" from="thomas_ojsxc_esc_at_localhost.com" type="test2" xmlns="jabber:client" id="4-msg">Message</message>', $result[0]->getStanza());
}
}
diff --git a/tests/integration/db/PresenceTest.php b/tests/integration/db/PresenceTest.php
index 47519a4..55b3dd3 100644
--- a/tests/integration/db/PresenceTest.php
+++ b/tests/integration/db/PresenceTest.php
@@ -57,8 +57,8 @@ class PresenceTest extends TestCase
{
$result = $reader->parse();
$result = $result['value'];
- $this->assertEquals($expectedElement->getTo(), $result->getTo());
- $this->assertEquals($expectedElement->getFrom(), $result->getFrom());
+ $this->assertEquals($expectedElement->getUnSanitizedTo(), $result->getTo());
+ $this->assertEquals($expectedElement->getUnSanitizedFrom(), $result->getFrom());
$this->assertEquals($expectedElement->getPresence(), $result->getPresence());
$this->assertEquals($expectedElement->getUserid(), $result->getUserid());
}
@@ -137,8 +137,8 @@ class PresenceTest extends TestCase
$writer->endElement();
$result = $writer->outputMemory();
- $this->assertEquals($to, $presenceEntity->getTo());
- $this->assertEquals($from, $presenceEntity->getFrom());
+ $this->assertEquals($to, $presenceEntity->getUnSanitizedTo());
+ $this->assertEquals($from, $presenceEntity->getUnSanitizedFrom());
$this->assertEquals($presence, $presenceEntity->getPresence());
$this->assertSabreXmlEqualsXml($expected, $result);
}
diff --git a/tests/integration/db/StanzaMapperTest.php b/tests/integration/db/StanzaMapperTest.php
index 1cbb50b..5db8727 100644
--- a/tests/integration/db/StanzaMapperTest.php
+++ b/tests/integration/db/StanzaMapperTest.php
@@ -44,8 +44,8 @@ class StanzaMapperTest extends MapperTestUtility
$stanza->setTo($to);
$stanza->setStanza($data);
- $this->assertEquals($stanza->getFrom(), $from);
- $this->assertEquals($stanza->getTo(), $to);
+ $this->assertEquals($stanza->getUnSanitizedFrom(), $from);
+ $this->assertEquals($stanza->getUnSanitizedTo(), $to);
$this->assertEquals($stanza->getStanza(), $data);
$this->mapper->insert($stanza);
@@ -53,8 +53,8 @@ class StanzaMapperTest extends MapperTestUtility
$result = $this->fetchAll();
$this->assertCount(1, $result);
- $this->assertEquals($stanza->getFrom(), $result[0]->getFrom());
- $this->assertEquals($stanza->getTo(), $result[0]->getTo());
+ $this->assertEquals($stanza->getUnSanitizedFrom(), $result[0]->getFrom());
+ $this->assertEquals($stanza->getUnSanitizedTo(), $result[0]->getTo());
$this->assertEquals($stanza->getStanza(), $result[0]->getStanza());
}
@@ -107,8 +107,8 @@ class StanzaMapperTest extends MapperTestUtility
// check if element is deleted
$result = $this->fetchAll();
$this->assertCount(1, $result);
- $this->assertEquals($stanza2->getFrom(), $result[0]->getFrom());
- $this->assertEquals($stanza2->getTo(), $result[0]->getTo());
+ $this->assertEquals($stanza2->getUnSanitizedFrom(), $result[0]->getFrom());
+ $this->assertEquals($stanza2->getUnSanitizedTo(), $result[0]->getTo());
$this->assertEquals($stanza2->getStanza(), $result[0]->getStanza());
}