]>
Commit | Line | Data |
---|---|---|
af31cfed NH |
1 | <?php |
2 | ||
3 | namespace Tests\Wallabag\CoreBundle\Command; | |
4 | ||
5 | use Symfony\Bundle\FrameworkBundle\Console\Application; | |
6 | use Symfony\Component\Console\Tester\CommandTester; | |
7 | use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; | |
8 | use Wallabag\CoreBundle\Command\ListUserCommand; | |
9 | ||
10 | class 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 | ||
f7a4b441 NH |
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()); | |
af31cfed NH |
74 | } |
75 | } |