aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2017-08-02 07:25:02 +0200
committerGitHub <noreply@github.com>2017-08-02 07:25:02 +0200
commit8b5bef48d5e5609c0c89a99f34fe56919125fa68 (patch)
tree6e0b786d397dbafdc1e6845e6ce59344f8d65f76 /tests/Wallabag
parent882da5c5eb283cbc7a869182b26a69b8fbebda2b (diff)
parentf7a4b441361404b378c30b7788b3699c208537ad (diff)
downloadwallabag-8b5bef48d5e5609c0c89a99f34fe56919125fa68.tar.gz
wallabag-8b5bef48d5e5609c0c89a99f34fe56919125fa68.tar.zst
wallabag-8b5bef48d5e5609c0c89a99f34fe56919125fa68.zip
Merge pull request #3301 from nclsHart/list-user-command
Add list users command
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}