ClassKeywordFixerTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * This file is part of PHP CS Fixer.
  5. *
  6. * (c) Fabien Potencier <fabien@symfony.com>
  7. * Dariusz Rumiński <dariusz.ruminski@gmail.com>
  8. *
  9. * This source file is subject to the MIT license that is bundled
  10. * with this source code in the file LICENSE.
  11. */
  12. namespace PhpCsFixer\Tests\Fixer\LanguageConstruct;
  13. use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
  14. /**
  15. * @internal
  16. *
  17. * @covers \PhpCsFixer\Fixer\LanguageConstruct\ClassKeywordFixer
  18. *
  19. * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\LanguageConstruct\ClassKeywordFixer>
  20. */
  21. final class ClassKeywordFixerTest extends AbstractFixerTestCase
  22. {
  23. /**
  24. * @dataProvider provideFixCases
  25. */
  26. public function testFix(string $expected, ?string $input = null): void
  27. {
  28. $this->doTest($expected, $input);
  29. }
  30. /**
  31. * @return iterable<array{0: string, 1?: ?string}>
  32. */
  33. public static function provideFixCases(): iterable
  34. {
  35. yield [
  36. '<?php
  37. echo \PhpCsFixer\FixerDefinition\CodeSample::class;
  38. echo \'Foo\Bar\Baz\';
  39. echo \PhpCsFixer\FixerDefinition\CodeSample::class;
  40. echo \PhpCsFixer\FixerDefinition\CodeSample::class;
  41. ',
  42. '<?php
  43. echo "PhpCsFixer\FixerDefinition\CodeSample";
  44. echo \'Foo\Bar\Baz\';
  45. echo \'PhpCsFixer\FixerDefinition\CodeSample\';
  46. echo \'\PhpCsFixer\FixerDefinition\CodeSample\';
  47. ',
  48. ];
  49. }
  50. }