* 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\PhpUnit; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @internal * * @covers \PhpCsFixer\Fixer\PhpUnit\PhpUnitDataProviderStaticFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\PhpUnit\PhpUnitDataProviderStaticFixer> * * @phpstan-import-type _AutogeneratedInputConfiguration from \PhpCsFixer\Fixer\PhpUnit\PhpUnitDataProviderStaticFixer */ final class PhpUnitDataProviderStaticFixerTest extends AbstractFixerTestCase { /** * @param _AutogeneratedInputConfiguration $configuration * * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null, array $configuration = []): void { $this->fixer->configure($configuration); $this->doTest($expected, $input); } /** * @return iterable}> */ public static function provideFixCases(): iterable { yield 'do not fix when containing dynamic calls by default' => [ 'init(); } }', ]; yield 'fix single' => [ 'getData(); } }', 'getData(); } }', ]; yield 'fix multiple' => [ 'init(); } public static function provider3() {} public static function provider4() {} }', 'init(); } public function provider3() {} public static function provider4() {} }', ]; yield 'fix with multilines' => [ 'getData(); } }', 'getData(); } }', ]; yield 'fix when data provider is abstract' => [ ' [ 'getFoo(); } public static function provideFooCases2() { /* no dynamic calls */ } }', 'getFoo(); } public function provideFooCases2() { /* no dynamic calls */ } }', ['force' => false], ]; yield 'fix when containing dynamic calls and with `force` enabled' => [ 'getFoo(); } public static function provideFooCases2() { /* no dynamic calls */ } }', 'getFoo(); } public function provideFooCases2() { /* no dynamic calls */ } }', ['force' => true], ]; } }