123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- declare(strict_types=1);
- namespace PhpCsFixer\Tests\AutoReview;
- use PhpCsFixer\Console\Application;
- use PhpCsFixer\Tests\TestCase;
- use Symfony\Component\Console\Command\Command;
- final class CommandTest extends TestCase
- {
-
- public function testCommandHasNameConst(Command $command): void
- {
- self::assertNotNull($command::getDefaultName());
- }
- public static function provideCommandHasNameConstCases(): iterable
- {
- $application = new Application();
- $commands = $application->all();
- $names = array_filter(
- array_keys($commands),
-
- 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);
- }
- }
|