]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php
Avoid multiple tag creation
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Tests / Helper / RuleBasedTaggerTest.php
index 37e137bfce42227bfc066a4586cfb8a2f06025e8..70951d46f64f3b50f826866f3d2708589aae0c3d 100644 (file)
@@ -121,6 +121,26 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
         $this->assertSame($tag, $tags[0]);
     }
 
+    public function testSameTagWithDifferentfMatchingRules()
+    {
+        $taggingRule = $this->getTaggingRule('bla bla', array('hey'));
+        $otherTaggingRule = $this->getTaggingRule('rule as string', array('hey'));
+
+        $user = $this->getUser([$taggingRule, $otherTaggingRule]);
+        $entry = new Entry($user);
+
+        $this->rulerz
+            ->method('satisfies')
+            ->willReturn(true);
+
+        $this->tagger->tag($entry);
+
+        $this->assertFalse($entry->getTags()->isEmpty());
+
+        $tags = $entry->getTags();
+        $this->assertCount(1, $tags);
+    }
+
     private function getUser(array $taggingRules = [])
     {
         $user = new User();