mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-23 08:06:33 +00:00
Add basic tests
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
e2f3800ccb
commit
3d57d625f8
1 changed files with 59 additions and 0 deletions
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Wallabag\CoreBundle\Command;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||||
|
use Symfony\Component\Console\Tester\CommandTester;
|
||||||
|
use Wallabag\CoreBundle\Command\CleanDuplicatesCommand;
|
||||||
|
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
|
||||||
|
|
||||||
|
class CleanDuplicatesCommandTest extends WallabagCoreTestCase
|
||||||
|
{
|
||||||
|
public function testRunTagAllCommandForAll()
|
||||||
|
{
|
||||||
|
$application = new Application($this->getClient()->getKernel());
|
||||||
|
$application->add(new CleanDuplicatesCommand());
|
||||||
|
|
||||||
|
$command = $application->find('wallabag:clean-duplicates');
|
||||||
|
|
||||||
|
$tester = new CommandTester($command);
|
||||||
|
$tester->execute([
|
||||||
|
'command' => $command->getName(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertContains('Cleaning through 3 user accounts', $tester->getDisplay());
|
||||||
|
$this->assertContains('Finished cleaning. 0 duplicates found in total', $tester->getDisplay());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRunTagAllCommandWithBadUsername()
|
||||||
|
{
|
||||||
|
$application = new Application($this->getClient()->getKernel());
|
||||||
|
$application->add(new CleanDuplicatesCommand());
|
||||||
|
|
||||||
|
$command = $application->find('wallabag:clean-duplicates');
|
||||||
|
|
||||||
|
$tester = new CommandTester($command);
|
||||||
|
$tester->execute([
|
||||||
|
'command' => $command->getName(),
|
||||||
|
'username' => 'unknown',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertContains('User "unknown" not found', $tester->getDisplay());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRunTagAllCommandForUser()
|
||||||
|
{
|
||||||
|
$application = new Application($this->getClient()->getKernel());
|
||||||
|
$application->add(new CleanDuplicatesCommand());
|
||||||
|
|
||||||
|
$command = $application->find('wallabag:clean-duplicates');
|
||||||
|
|
||||||
|
$tester = new CommandTester($command);
|
||||||
|
$tester->execute([
|
||||||
|
'command' => $command->getName(),
|
||||||
|
'username' => 'admin',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertContains('Cleaned 0 duplicates for user admin', $tester->getDisplay());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue