* 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\AutoReview; use PhpCsFixer\Console\Application; use PhpCsFixer\Tests\TestCase; use Symfony\Component\Console\Command\Command; /** * @author Dariusz Rumiński * * @internal * * @coversNothing * * @group auto-review * @group covers-nothing */ final class CommandTest extends TestCase { /** * @dataProvider provideCommandHasNameConstCases */ public function testCommandHasNameConst(Command $command): void { self::assertNotNull($command::getDefaultName()); } /** * @return iterable */ public static function provideCommandHasNameConstCases(): iterable { $application = new Application(); $commands = $application->all(); $names = array_filter( array_keys($commands), // is not an alias and is our command static fn (string $name): bool => !\in_array($name, $commands[$name]->getAliases(), true) && str_starts_with(\get_class($commands[$name]), 'PhpCsFixer\\') ); return array_map(static fn (string $name): array => [$commands[$name]], $names); } }