diff --git a/tests/Console/Command/ListFilesCommandTest.php b/tests/Console/Command/ListFilesCommandTest.php index 3b7f713949f..c1308c6167e 100644 --- a/tests/Console/Command/ListFilesCommandTest.php +++ b/tests/Console/Command/ListFilesCommandTest.php @@ -35,6 +35,7 @@ public function testListWithConfig() // make the test also work on windows $expectedPath = str_replace('/', \DIRECTORY_SEPARATOR, $expectedPath); + static::assertSame(0, $commandTester->getStatusCode()); static::assertSame(escapeshellarg($expectedPath).PHP_EOL, $commandTester->getDisplay()); } diff --git a/tests/Console/Command/ListSetsCommandTest.php b/tests/Console/Command/ListSetsCommandTest.php new file mode 100644 index 00000000000..083227896b4 --- /dev/null +++ b/tests/Console/Command/ListSetsCommandTest.php @@ -0,0 +1,53 @@ + + * Dariusz RumiƄski + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace PhpCsFixer\Tests\Console\Command; + +use PhpCsFixer\Console\Application; +use PhpCsFixer\Console\Command\ListSetsCommand; +use PhpCsFixer\Tests\TestCase; +use PhpCsFixer\ToolInfo; +use Symfony\Component\Console\Tester\CommandTester; + +/** + * @internal + * + * @covers \PhpCsFixer\Console\Command\ListSetsCommand + */ +final class ListSetsCommandTest extends TestCase +{ + public function testListWithConfig() + { + $commandTester = $this->doTestExecute([]); + + $resultStart = ' 1) @DoctrineAnnotation + Rules covering Doctrine annotations'; + static::assertStringStartsWith($resultStart, $commandTester->getDisplay()); + static::assertSame(0, $commandTester->getStatusCode()); + } + + /** + * @return CommandTester + */ + private function doTestExecute(array $arguments) + { + $application = new Application(); + $application->add(new ListSetsCommand()); + + $command = $application->find('list-sets'); + $commandTester = new CommandTester($command); + + $commandTester->execute($arguments); + + return $commandTester; + } +}