3 namespace Tests\Wallabag\CoreBundle\Command
;
5 use Symfony\Bundle\FrameworkBundle\Console\Application
;
6 use Symfony\Component\Console\Tester\CommandTester
;
7 use Wallabag\CoreBundle\Command\CleanDuplicatesCommand
;
8 use Tests\Wallabag\CoreBundle\WallabagCoreTestCase
;
10 class CleanDuplicatesCommandTest
extends WallabagCoreTestCase
12 public function testRunTagAllCommandForAll()
14 $application = new Application($this->getClient()->getKernel());
15 $application->add(new CleanDuplicatesCommand());
17 $command = $application->find('wallabag:clean-duplicates');
19 $tester = new CommandTester($command);
21 'command' => $command->getName(),
24 $this->assertContains('Cleaning through 3 user accounts', $tester->getDisplay());
25 $this->assertContains('Finished cleaning. 0 duplicates found in total', $tester->getDisplay());
28 public function testRunTagAllCommandWithBadUsername()
30 $application = new Application($this->getClient()->getKernel());
31 $application->add(new CleanDuplicatesCommand());
33 $command = $application->find('wallabag:clean-duplicates');
35 $tester = new CommandTester($command);
37 'command' => $command->getName(),
38 'username' => 'unknown',
41 $this->assertContains('User "unknown" not found', $tester->getDisplay());
44 public function testRunTagAllCommandForUser()
46 $application = new Application($this->getClient()->getKernel());
47 $application->add(new CleanDuplicatesCommand());
49 $command = $application->find('wallabag:clean-duplicates');
51 $tester = new CommandTester($command);
53 'command' => $command->getName(),
54 'username' => 'admin',
57 $this->assertContains('Cleaned 0 duplicates for user admin', $tester->getDisplay());