2017-07-30 20:04:29 +00:00
|
|
|
<?php
|
|
|
|
|
2024-02-19 00:30:12 +00:00
|
|
|
namespace Tests\Wallabag\Command;
|
2017-07-30 20:04:29 +00:00
|
|
|
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
|
|
|
use Symfony\Component\Console\Tester\CommandTester;
|
2024-02-24 19:24:51 +00:00
|
|
|
use Tests\Wallabag\WallabagTestCase;
|
2017-07-30 20:04:29 +00:00
|
|
|
|
2024-02-24 19:24:51 +00:00
|
|
|
class ListUserCommandTest extends WallabagTestCase
|
2017-07-30 20:04:29 +00:00
|
|
|
{
|
|
|
|
public function testRunListUserCommand()
|
|
|
|
{
|
2022-11-23 16:09:32 +00:00
|
|
|
$application = new Application($this->getTestClient()->getKernel());
|
2017-07-30 20:04:29 +00:00
|
|
|
|
|
|
|
$command = $application->find('wallabag:user:list');
|
|
|
|
|
|
|
|
$tester = new CommandTester($command);
|
2022-09-03 00:28:07 +00:00
|
|
|
$tester->execute([]);
|
2017-07-30 20:04:29 +00:00
|
|
|
|
2020-06-15 11:37:50 +00:00
|
|
|
$this->assertStringContainsString('3/3 user(s) displayed.', $tester->getDisplay());
|
2017-07-31 21:20:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testRunListUserCommandWithLimit()
|
|
|
|
{
|
2022-11-23 16:09:32 +00:00
|
|
|
$application = new Application($this->getTestClient()->getKernel());
|
2017-07-31 21:20:41 +00:00
|
|
|
|
|
|
|
$command = $application->find('wallabag:user:list');
|
|
|
|
|
|
|
|
$tester = new CommandTester($command);
|
|
|
|
$tester->execute([
|
|
|
|
'--limit' => 2,
|
|
|
|
]);
|
|
|
|
|
2020-06-15 11:37:50 +00:00
|
|
|
$this->assertStringContainsString('2/3 user(s) displayed.', $tester->getDisplay());
|
2017-07-31 21:20:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testRunListUserCommandWithSearch()
|
|
|
|
{
|
2022-11-23 16:09:32 +00:00
|
|
|
$application = new Application($this->getTestClient()->getKernel());
|
2017-07-31 21:20:41 +00:00
|
|
|
|
|
|
|
$command = $application->find('wallabag:user:list');
|
|
|
|
|
|
|
|
$tester = new CommandTester($command);
|
|
|
|
$tester->execute([
|
|
|
|
'search' => 'boss',
|
|
|
|
]);
|
|
|
|
|
2020-06-15 11:37:50 +00:00
|
|
|
$this->assertStringContainsString('1/3 (filtered) user(s) displayed.', $tester->getDisplay());
|
2017-07-31 21:20:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testRunListUserCommandWithSearchAndLimit()
|
|
|
|
{
|
2022-11-23 16:09:32 +00:00
|
|
|
$application = new Application($this->getTestClient()->getKernel());
|
2017-07-31 21:20:41 +00:00
|
|
|
|
|
|
|
$command = $application->find('wallabag:user:list');
|
|
|
|
|
|
|
|
$tester = new CommandTester($command);
|
|
|
|
$tester->execute([
|
|
|
|
'search' => 'bo',
|
|
|
|
'--limit' => 1,
|
|
|
|
]);
|
|
|
|
|
2020-06-15 11:37:50 +00:00
|
|
|
$this->assertStringContainsString('1/3 (filtered) user(s) displayed.', $tester->getDisplay());
|
2017-07-30 20:04:29 +00:00
|
|
|
}
|
|
|
|
}
|