]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php
Add a command to automatically tag all entries for a user
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Tests / Helper / RuleBasedTaggerTest.php
index 56a1ed61e50762743e9146562f10acffc1794d8b..5180f7ddb387b680279bf5267aa43a95bbf3718a 100644 (file)
@@ -12,15 +12,17 @@ use Wallabag\CoreBundle\Helper\RuleBasedTagger;
 class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
 {
     private $rulerz;
-    private $repository;
+    private $tagRepository;
+    private $entryRepository;
     private $tagger;
 
     public function setUp()
     {
-        $this->rulerz     = $this->getRulerZMock();
-        $this->repository = $this->getTagRepositoryMock();
+        $this->rulerz          = $this->getRulerZMock();
+        $this->tagRepository   = $this->getTagRepositoryMock();
+        $this->entryRepository = $this->getEntryRepositoryMock();
 
-        $this->tagger     = new RuleBasedTagger($this->rulerz, $this->repository);
+        $this->tagger = new RuleBasedTagger($this->rulerz, $this->tagRepository, $this->entryRepository);
     }
 
     public function testTagWithNoRule()
@@ -106,7 +108,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
             ->with($entry, 'rule as string')
             ->willReturn(true);
 
-        $this->repository
+        $this->tagRepository
             ->expects($this->once())
             ->method('findOneByLabelAndUserId')
             ->willReturn($tag);
@@ -155,4 +157,11 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
             ->disableOriginalConstructor()
             ->getMock();
     }
+
+    private function getEntryRepositoryMock()
+    {
+        return $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
+            ->disableOriginalConstructor()
+            ->getMock();
+    }
 }