* 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 provideLowerGeneratedCases */ public function testFixLowerGeneratedCases(string $expected, ?string $input = null): void { $this->fixer->configure(['case' => 'lower']); $this->doTest($expected, $input); } /** * @dataProvider provideUpperGeneratedCases */ public function testFixUpperGeneratedCases(string $expected, ?string $input = null): void { $this->fixer->configure(['case' => 'upper']); $this->doTest($expected, $input); } public function provideLowerGeneratedCases(): \Generator { foreach (['true', 'false', 'null'] as $case) { yield [ sprintf('doTest($expected, $input); } public function provideFixCases(): array { return [ [ ''], ['False = 1; $this->True = 2; $this->Null = 3; } }'], ]; } /** * @dataProvider provideFix56Cases * * @requires PHP <7.0 */ public function testFix56(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } public function provideFix56Cases(): array { return [ ['doTest($expected, $input); } public static function provideFix80Cases(): array { return [ ['False; } }'], ]; } /** * @dataProvider provideFix81Cases * @requires PHP 8.1 */ public function testFix81(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } public static function provideFix81Cases(): \Generator { yield [ '