aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php75
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php b/tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php
new file mode 100644
index 00000000..9068cf59
--- /dev/null
+++ b/tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php
@@ -0,0 +1,75 @@
1<?php
2
3namespace Tests\Wallabag\CoreBundle\Command;
4
5use Symfony\Bundle\FrameworkBundle\Console\Application;
6use Symfony\Component\Console\Tester\CommandTester;
7use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
8use Wallabag\CoreBundle\Command\ListUserCommand;
9
10class ListUserCommandTest extends WallabagCoreTestCase
11{
12 public function testRunListUserCommand()
13 {
14 $application = new Application($this->getClient()->getKernel());
15 $application->add(new ListUserCommand());
16
17 $command = $application->find('wallabag:user:list');
18
19 $tester = new CommandTester($command);
20 $tester->execute([
21 'command' => $command->getName(),
22 ]);
23
24 $this->assertContains('3/3 user(s) displayed.', $tester->getDisplay());
25 }
26
27 public function testRunListUserCommandWithLimit()
28 {
29 $application = new Application($this->getClient()->getKernel());
30 $application->add(new ListUserCommand());
31
32 $command = $application->find('wallabag:user:list');
33
34 $tester = new CommandTester($command);
35 $tester->execute([
36 'command' => $command->getName(),
37 '--limit' => 2,
38 ]);
39
40 $this->assertContains('2/3 user(s) displayed.', $tester->getDisplay());
41 }
42
43 public function testRunListUserCommandWithSearch()
44 {
45 $application = new Application($this->getClient()->getKernel());
46 $application->add(new ListUserCommand());
47
48 $command = $application->find('wallabag:user:list');
49
50 $tester = new CommandTester($command);
51 $tester->execute([
52 'command' => $command->getName(),
53 'search' => 'boss',
54 ]);
55
56 $this->assertContains('1/3 (filtered) user(s) displayed.', $tester->getDisplay());
57 }
58
59 public function testRunListUserCommandWithSearchAndLimit()
60 {
61 $application = new Application($this->getClient()->getKernel());
62 $application->add(new ListUserCommand());
63
64 $command = $application->find('wallabag:user:list');
65
66 $tester = new CommandTester($command);
67 $tester->execute([
68 'command' => $command->getName(),
69 'search' => 'bo',
70 '--limit' => 1,
71 ]);
72
73 $this->assertContains('1/3 (filtered) user(s) displayed.', $tester->getDisplay());
74 }
75}