3 namespace Wallabag\CoreBundle\Tests\Command
;
5 use Symfony\Bundle\FrameworkBundle\Console\Application
;
6 use Symfony\Component\Console\Tester\CommandTester
;
7 use Wallabag\CoreBundle\Command\TagAllCommand
;
8 use Wallabag\CoreBundle\Tests\WallabagCoreTestCase
;
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);
24 $tester->execute(array(
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);
37 $tester->execute(array(
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);
53 $tester->execute(array(
54 'command' => $command->getName(),
55 'username' => 'admin',
58 $this->assertContains('Tagging entries for user « admin »... Done', $tester->getDisplay());