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()
->with($entry, 'rule as string')
->willReturn(true);
- $this->repository
+ $this->tagRepository
->expects($this->once())
->method('findOneByLabelAndUserId')
->willReturn($tag);
->disableOriginalConstructor()
->getMock();
}
+
+ private function getEntryRepositoryMock()
+ {
+ return $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
+ ->disableOriginalConstructor()
+ ->getMock();
+ }
}