aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php b/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php
index 1de134b8..cddc8b08 100644
--- a/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php
@@ -69,9 +69,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
69 69
70 $tags = $entry->getTags(); 70 $tags = $entry->getTags();
71 $this->assertSame('foo', $tags[0]->getLabel()); 71 $this->assertSame('foo', $tags[0]->getLabel());
72 $this->assertSame($user, $tags[0]->getUser());
73 $this->assertSame('bar', $tags[1]->getLabel()); 72 $this->assertSame('bar', $tags[1]->getLabel());
74 $this->assertSame($user, $tags[1]->getUser());
75 } 73 }
76 74
77 public function testTagWithAMixOfMatchingRules() 75 public function testTagWithAMixOfMatchingRules()
@@ -92,7 +90,6 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
92 90
93 $tags = $entry->getTags(); 91 $tags = $entry->getTags();
94 $this->assertSame('foo', $tags[0]->getLabel()); 92 $this->assertSame('foo', $tags[0]->getLabel());
95 $this->assertSame($user, $tags[0]->getUser());
96 } 93 }
97 94
98 public function testWhenTheTagExists() 95 public function testWhenTheTagExists()
@@ -100,7 +97,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
100 $taggingRule = $this->getTaggingRule('rule as string', array('foo')); 97 $taggingRule = $this->getTaggingRule('rule as string', array('foo'));
101 $user = $this->getUser([$taggingRule]); 98 $user = $this->getUser([$taggingRule]);
102 $entry = new Entry($user); 99 $entry = new Entry($user);
103 $tag = new Tag($user); 100 $tag = new Tag();
101 $tag->setLabel('foo');
104 102
105 $this->rulerz 103 $this->rulerz
106 ->expects($this->once()) 104 ->expects($this->once())
@@ -110,7 +108,9 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
110 108
111 $this->tagRepository 109 $this->tagRepository
112 ->expects($this->once()) 110 ->expects($this->once())
113 ->method('findOneByLabelAndUserId') 111 // the method `findOneByLabel` doesn't exist, EntityRepository will then call `_call` method
112 // to magically call the `findOneBy` with ['label' => 'foo']
113 ->method('__call')
114 ->willReturn($tag); 114 ->willReturn($tag);
115 115
116 $this->tagger->tag($entry); 116 $this->tagger->tag($entry);
@@ -118,7 +118,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
118 $this->assertFalse($entry->getTags()->isEmpty()); 118 $this->assertFalse($entry->getTags()->isEmpty());
119 119
120 $tags = $entry->getTags(); 120 $tags = $entry->getTags();
121 $this->assertSame($tag, $tags[0]); 121 $this->assertSame($tag->getLabel(), $tags[0]->getLabel());
122 } 122 }
123 123
124 public function testSameTagWithDifferentfMatchingRules() 124 public function testSameTagWithDifferentfMatchingRules()