aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas@loeuillet.org>2016-01-22 09:36:50 +0100
committerNicolas Lœuillet <nicolas@loeuillet.org>2016-01-22 09:36:50 +0100
commit6c32aaae95caf6fcd6740fa1a78f8af31bb6370f (patch)
tree87a1f573e7b405f34588a91f87b9196810cdaa7a /src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php
parent9aa66d6244935fe86a5598fbdbe518cf6204af2e (diff)
parent23afdf3a70a5035cb58b76138a8627701ba55273 (diff)
downloadwallabag-6c32aaae95caf6fcd6740fa1a78f8af31bb6370f.tar.gz
wallabag-6c32aaae95caf6fcd6740fa1a78f8af31bb6370f.tar.zst
wallabag-6c32aaae95caf6fcd6740fa1a78f8af31bb6370f.zip
Merge pull request #1614 from wallabag/v2-few-fixes
Few fixes
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php
new file mode 100644
index 00000000..653c1a93
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Tests/Command/TagAllCommandTest.php
@@ -0,0 +1,60 @@
1<?php
2
3namespace Wallabag\CoreBundle\Tests\Command;
4
5use Symfony\Bundle\FrameworkBundle\Console\Application;
6use Symfony\Component\Console\Tester\CommandTester;
7use Wallabag\CoreBundle\Command\TagAllCommand;
8use Wallabag\CoreBundle\Tests\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(array(
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(array(
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(array(
54 'command' => $command->getName(),
55 'username' => 'admin',
56 ));
57
58 $this->assertContains('Tagging entries for user « admin »... Done', $tester->getDisplay());
59 }
60}