diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-09-25 16:11:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-25 16:11:06 +0200 |
commit | 7e98ad962680fac17b3b90ae34b9c6e5afe7636f (patch) | |
tree | 451f2c7ec7011f1f0ee8911fb1921b02f158e1dc /tests/Wallabag/CoreBundle/Helper | |
parent | 9d7dd6b0d2480d3efff5b0ab1461f2ef99bfd57a (diff) | |
parent | 289875836a09944f5993d33753042abfef13809e (diff) | |
download | wallabag-7e98ad962680fac17b3b90ae34b9c6e5afe7636f.tar.gz wallabag-7e98ad962680fac17b3b90ae34b9c6e5afe7636f.tar.zst wallabag-7e98ad962680fac17b3b90ae34b9c6e5afe7636f.zip |
Merge pull request #2308 from wallabag/tags-duplicate
Fix duplicate tags on import
Diffstat (limited to 'tests/Wallabag/CoreBundle/Helper')
-rw-r--r-- | tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index 7abb0737..5d772602 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php | |||
@@ -296,6 +296,29 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
296 | $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); | 296 | $this->assertEquals('tag2', $entry->getTags()[1]->getLabel()); |
297 | } | 297 | } |
298 | 298 | ||
299 | public function testAssignTagsNotFlushed() | ||
300 | { | ||
301 | $graby = $this->getMockBuilder('Graby\Graby') | ||
302 | ->disableOriginalConstructor() | ||
303 | ->getMock(); | ||
304 | |||
305 | $tagRepo = $this->getTagRepositoryMock(); | ||
306 | $tagRepo->expects($this->never()) | ||
307 | ->method('__call'); | ||
308 | |||
309 | $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger()); | ||
310 | |||
311 | $tagEntity = new Tag(); | ||
312 | $tagEntity->setLabel('tag1'); | ||
313 | |||
314 | $entry = new Entry(new User()); | ||
315 | |||
316 | $proxy->assignTagsToEntry($entry, 'tag1', [$tagEntity]); | ||
317 | |||
318 | $this->assertCount(1, $entry->getTags()); | ||
319 | $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); | ||
320 | } | ||
321 | |||
299 | private function getTaggerMock() | 322 | private function getTaggerMock() |
300 | { | 323 | { |
301 | return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger') | 324 | return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger') |