aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-06-01 21:27:35 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-06-22 17:59:35 +0200
commit23634d5d842dabcf5d7475e2becb7e127824239e (patch)
treeb91688722a996c46f27e8fe0542c356424483da3 /tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php
parent891a026e31ad54ca90b70f6026f23260cfadb7fd (diff)
downloadwallabag-23634d5d842dabcf5d7475e2becb7e127824239e.tar.gz
wallabag-23634d5d842dabcf5d7475e2becb7e127824239e.tar.zst
wallabag-23634d5d842dabcf5d7475e2becb7e127824239e.zip
Jump to Symfony 3.1
Diffstat (limited to 'tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php')
-rw-r--r--tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php b/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php
new file mode 100644
index 00000000..ec31708f
--- /dev/null
+++ b/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php
@@ -0,0 +1,60 @@
1<?php
2
3namespace Tests\Wallabag\CoreBundle\Command;
4
5use Symfony\Bundle\FrameworkBundle\Console\Application;
6use Symfony\Component\Console\Tester\CommandTester;
7use Wallabag\CoreBundle\Command\TagAllCommand;
8use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
9
10class TagAllCommandTest extends WallabagCoreTestCase
11{
12 /**
13 * @expectedException Symfony\Component\Console\Exception\RuntimeException
14 * @expectedExceptionMessage Not enough arguments (missing: "username")
15 */
16 public function testRunTagAllCommandWithoutUsername()
17 {
18 $application = new Application($this->getClient()->getKernel());
19 $application->add(new TagAllCommand());
20
21 $command = $application->find('wallabag:tag:all');
22
23 $tester = new CommandTester($command);
24 $tester->execute([
25 'command' => $command->getName(),
26 ]);
27 }
28
29 public function testRunTagAllCommandWithBadUsername()
30 {
31 $application = new Application($this->getClient()->getKernel());
32 $application->add(new TagAllCommand());
33
34 $command = $application->find('wallabag:tag:all');
35
36 $tester = new CommandTester($command);
37 $tester->execute([
38 'command' => $command->getName(),
39 'username' => 'unknown',
40 ]);
41
42 $this->assertContains('User "unknown" not found', $tester->getDisplay());
43 }
44
45 public function testRunTagAllCommand()
46 {
47 $application = new Application($this->getClient()->getKernel());
48 $application->add(new TagAllCommand());
49
50 $command = $application->find('wallabag:tag:all');
51
52 $tester = new CommandTester($command);
53 $tester->execute([
54 'command' => $command->getName(),
55 'username' => 'admin',
56 ]);
57
58 $this->assertContains('Tagging entries for user « admin »... Done', $tester->getDisplay());
59 }
60}