Skip to content

Commit a80a5b4

Browse files
committed
Test ReadmeCommand with CommandTester
1 parent 767b4f3 commit a80a5b4

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

tests/Readme/ReadmeCommandTest.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
use PhpCsFixerCustomFixersDev\Readme\ReadmeCommand;
88
use PHPUnit\Framework\TestCase;
9-
use Symfony\Component\Console\Application;
10-
use Symfony\Component\Console\Tester\ApplicationTester;
9+
use Symfony\Component\Console\Tester\CommandTester;
1110

1211
/**
1312
* @internal
@@ -18,17 +17,9 @@ final class ReadmeCommandTest extends TestCase
1817
{
1918
public function testReadmeIsUpToDate(): void
2019
{
21-
$application = new Application();
22-
$command = new ReadmeCommand('readme');
20+
$tester = new CommandTester(new ReadmeCommand());
2321

24-
$application->add($command);
25-
$application->setDefaultCommand($command->getName(), true);
26-
$application->setAutoExit(false);
27-
$application->setCatchExceptions(false);
28-
29-
$tester = new ApplicationTester($application);
30-
31-
$tester->run([]);
22+
$tester->execute([]);
3223

3324
static::assertStringEqualsFile(
3425
__DIR__ . '/../../README.md',

0 commit comments

Comments
 (0)