aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBernhard Reiter <ockham@raz.or.at>2014-09-30 12:19:08 +0200
committerBernhard Reiter <ockham@raz.or.at>2014-10-14 00:06:07 +0200
commit3e5d725502e403df5a5af4a197f4b94d147efccf (patch)
tree6efbe534f8b74df6b51ded654d7173353c4a4ff9 /tests
parenta67803fb5df02e7e8924d245d8609aa746a59889 (diff)
downloadnextcloud-server-3e5d725502e403df5a5af4a197f4b94d147efccf.tar.gz
nextcloud-server-3e5d725502e403df5a5af4a197f4b94d147efccf.zip
Test addMultiple() with $sync=true.
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/tags.php31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/lib/tags.php b/tests/lib/tags.php
index 3eba470a509..9195587f1dd 100644
--- a/tests/lib/tags.php
+++ b/tests/lib/tags.php
@@ -84,7 +84,36 @@ class Test_Tags extends PHPUnit_Framework_TestCase {
$this->assertTrue($tagger->hasTag($tag));
}
- $this->assertCount(4, $tagger->getTags(), 'Not all tags added');
+ $tagMaps = $tagger->getTags();
+ $this->assertCount(4, $tagMaps, 'Not all tags added');
+ foreach($tagMaps as $tagMap) {
+ $this->assertEquals(null, $tagMap['id']);
+ }
+
+ // As addMultiple has been called without $sync=true, the tags aren't
+ // saved to the database, so they're gone when we reload $tagger:
+
+ $tagger = $this->tagMgr->load($this->objectType);
+ $this->assertEquals(0, count($tagger->getTags()));
+
+ // Now, we call addMultiple() with $sync=true so the tags will be
+ // be saved to the database.
+ $result = $tagger->addMultiple($tags, true);
+ $this->assertTrue((bool)$result);
+
+ $tagMaps = $tagger->getTags();
+ foreach($tagMaps as $tagMap) {
+ $this->assertNotEquals(null, $tagMap['id']);
+ }
+
+ // Reload the tagger.
+ $tagger = $this->tagMgr->load($this->objectType);
+
+ foreach($tags as $tag) {
+ $this->assertTrue($tagger->hasTag($tag));
+ }
+
+ $this->assertCount(4, $tagger->getTags(), 'Not all previously saved tags found');
}
public function testIsEmpty() {