* 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\Fixer\Casing; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @author Dariusz Rumiński * * @internal * * @covers \PhpCsFixer\Fixer\Casing\ConstantCaseFixer */ final class ConstantCaseFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } public static function provideFixCases(): iterable { yield [ '']; yield ['False = 1; $this->True = 2; $this->Null = 3; } }']; } /** * @dataProvider provideFixToLowerCases */ public function testFixToLower(string $expected, ?string $input = null): void { $this->fixer->configure(['case' => 'lower']); $this->doTest($expected, $input); } public static function provideFixToLowerCases(): iterable { foreach (['true', 'false', 'null'] as $case) { yield [ sprintf('fixer->configure(['case' => 'upper']); $this->doTest($expected, $input); } public static function provideFixToUpperCases(): iterable { foreach (['true', 'false', 'null'] as $case) { yield [ sprintf('doTest($expected, $input); } public static function provideFix80Cases(): iterable { yield ' nullsafe operator' => ['False; } }']; } /** * @dataProvider provideFix81Cases * * @requires PHP 8.1 */ public function testFix81(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } public static function provideFix81Cases(): iterable { yield 'final class const' => [ ' [ ' [ '