Add a command to automatically tag all entries for a user

This commit is contained in:
Kévin Gomez
2015-10-24 15:11:06 +02:00
parent cad8cda7af
commit 625acf3352
9 changed files with 149 additions and 11 deletions

View 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();
}
}