3 namespace Tests\Wallabag\CoreBundle\Command
;
5 use Symfony\Bundle\FrameworkBundle\Console\Application
;
6 use Symfony\Component\Console\Tester\CommandTester
;
7 use Tests\Wallabag\CoreBundle\WallabagCoreTestCase
;
8 use Wallabag\CoreBundle\Command\TagAllCommand
;
10 class TagAllCommandTest
extends WallabagCoreTestCase
13 * @expectedException \Symfony\Component\Console\Exception\RuntimeException
14 * @expectedExceptionMessage Not enough arguments (missing: "username")
16 public function testRunTagAllCommandWithoutUsername()
18 $application = new Application($this->getClient()->getKernel());
19 $application->add(new TagAllCommand());
21 $command = $application->find('wallabag:tag:all');
23 $tester = new CommandTester($command);
25 'command' => $command->getName(),
29 public function testRunTagAllCommandWithBadUsername()
31 $application = new Application($this->getClient()->getKernel());
32 $application->add(new TagAllCommand());
34 $command = $application->find('wallabag:tag:all');
36 $tester = new CommandTester($command);
38 'command' => $command->getName(),
39 'username' => 'unknown',
42 $this->assertContains('User "unknown" not found', $tester->getDisplay());
45 public function testRunTagAllCommand()
47 $application = new Application($this->getClient()->getKernel());
48 $application->add(new TagAllCommand());
50 $command = $application->find('wallabag:tag:all');
52 $tester = new CommandTester($command);
54 'command' => $command->getName(),
55 'username' => 'admin',
58 $this->assertContains('Tagging entries for user admin...', $tester->getDisplay());
59 $this->assertContains('Done', $tester->getDisplay());