aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php1
-rw-r--r--src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php26
2 files changed, 26 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php
index fb2d1f87..41ef25b8 100644
--- a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php
+++ b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php
@@ -65,7 +65,6 @@ class RuleBasedTagger
65 $tag = $this->getTag($user, $label); 65 $tag = $this->getTag($user, $label);
66 66
67 $entry->addTag($tag); 67 $entry->addTag($tag);
68 $entries[] = $entry;
69 } 68 }
70 } 69 }
71 } 70 }
diff --git a/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php b/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php
index 70951d46..1de134b8 100644
--- a/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php
@@ -141,6 +141,32 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
141 $this->assertCount(1, $tags); 141 $this->assertCount(1, $tags);
142 } 142 }
143 143
144 public function testTagAllEntriesForAUser()
145 {
146 $taggingRule = $this->getTaggingRule('bla bla', array('hey'));
147
148 $user = $this->getUser([$taggingRule]);
149
150 $this->rulerz
151 ->method('satisfies')
152 ->willReturn(true);
153
154 $this->rulerz
155 ->method('filter')
156 ->willReturn(array(new Entry($user), new Entry($user)));
157
158 $entries = $this->tagger->tagAllForUser($user);
159
160 $this->assertCount(2, $entries);
161
162 foreach ($entries as $entry) {
163 $tags = $entry->getTags();
164
165 $this->assertCount(1, $tags);
166 $this->assertEquals('hey', $tags[0]->getLabel());
167 }
168 }
169
144 private function getUser(array $taggingRules = []) 170 private function getUser(array $taggingRules = [])
145 { 171 {
146 $user = new User(); 172 $user = new User();