wallabag/tests/Command/ListUserCommandTest.php

66 lines
1.9 KiB
PHP
Raw Normal View History

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