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