wallabag/tests/Wallabag/CoreBundle/Command/TagAllCommandTest.php

54 lines
1.6 KiB
PHP
Raw Normal View History

<?php
2016-06-01 19:27:35 +00:00
namespace Tests\Wallabag\CoreBundle\Command;
use Symfony\Bundle\FrameworkBundle\Console\Application;
2022-08-28 14:59:43 +00:00
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Tester\CommandTester;
2016-06-01 19:27:35 +00:00
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
class TagAllCommandTest extends WallabagCoreTestCase
{
public function testRunTagAllCommandWithoutUsername()
{
2022-08-28 14:59:43 +00:00
$this->expectException(RuntimeException::class);
2020-06-15 11:37:50 +00:00
$this->expectExceptionMessage('Not enough arguments (missing: "username")');
$application = new Application($this->getTestClient()->getKernel());
$command = $application->find('wallabag:tag:all');
$tester = new CommandTester($command);
2022-09-03 00:28:07 +00:00
$tester->execute([]);
}
public function testRunTagAllCommandWithBadUsername()
{
$application = new Application($this->getTestClient()->getKernel());
$command = $application->find('wallabag:tag:all');
$tester = new CommandTester($command);
$tester->execute([
'username' => 'unknown',
]);
2020-06-15 11:37:50 +00:00
$this->assertStringContainsString('User "unknown" not found', $tester->getDisplay());
}
public function testRunTagAllCommand()
{
$application = new Application($this->getTestClient()->getKernel());
$command = $application->find('wallabag:tag:all');
$tester = new CommandTester($command);
$tester->execute([
'username' => 'admin',
]);
2020-06-15 11:37:50 +00:00
$this->assertStringContainsString('Tagging entries for user admin...', $tester->getDisplay());
$this->assertStringContainsString('Done', $tester->getDisplay());
}
}