From f7a4b441361404b378c30b7788b3699c208537ad Mon Sep 17 00:00:00 2001 From: Nicolas Hart Date: Mon, 31 Jul 2017 23:20:41 +0200 Subject: add search argument and limit option to list users command --- .../CoreBundle/Command/ListUserCommandTest.php | 51 +++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 'tests/Wallabag') diff --git a/tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php b/tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php index 5e644247..9068cf59 100644 --- a/tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/ListUserCommandTest.php @@ -21,6 +21,55 @@ class ListUserCommandTest extends WallabagCoreTestCase 'command' => $command->getName(), ]); - $this->assertContains('3 user(s) displayed.', $tester->getDisplay()); + $this->assertContains('3/3 user(s) displayed.', $tester->getDisplay()); + } + + public function testRunListUserCommandWithLimit() + { + $application = new Application($this->getClient()->getKernel()); + $application->add(new ListUserCommand()); + + $command = $application->find('wallabag:user:list'); + + $tester = new CommandTester($command); + $tester->execute([ + 'command' => $command->getName(), + '--limit' => 2, + ]); + + $this->assertContains('2/3 user(s) displayed.', $tester->getDisplay()); + } + + public function testRunListUserCommandWithSearch() + { + $application = new Application($this->getClient()->getKernel()); + $application->add(new ListUserCommand()); + + $command = $application->find('wallabag:user:list'); + + $tester = new CommandTester($command); + $tester->execute([ + 'command' => $command->getName(), + 'search' => 'boss', + ]); + + $this->assertContains('1/3 (filtered) user(s) displayed.', $tester->getDisplay()); + } + + public function testRunListUserCommandWithSearchAndLimit() + { + $application = new Application($this->getClient()->getKernel()); + $application->add(new ListUserCommand()); + + $command = $application->find('wallabag:user:list'); + + $tester = new CommandTester($command); + $tester->execute([ + 'command' => $command->getName(), + 'search' => 'bo', + '--limit' => 1, + ]); + + $this->assertContains('1/3 (filtered) user(s) displayed.', $tester->getDisplay()); } } -- cgit v1.2.3