* 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\PhpUnitDataProviderMethodOrderFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\PhpUnit\PhpUnitDataProviderMethodOrderFixer> * * @phpstan-import-type _AutogeneratedInputConfiguration from \PhpCsFixer\Fixer\PhpUnit\PhpUnitDataProviderMethodOrderFixer */ final class PhpUnitDataProviderMethodOrderFixerTest 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 'simple - placement after' => [ <<<'PHP' [ <<<'PHP' 'before'], ]; yield 'empty test class' => [ <<<'PHP' [ <<<'PHP' [ <<<'PHP' [ <<<'PHP' [ <<<'PHP' [ <<<'PHP' [ <<<'PHP' 'before'], ]; yield 'multiple data providers for one test method' => [ <<<'PHP' [ <<<'PHP' [ <<<'PHP' 'before'], ]; yield 'with other methods - placement after' => [ <<<'PHP' [ <<<'PHP' 'before'], ]; yield 'with other methods II' => [ <<<'PHP' fixer->configure($configuration); $this->doTest($expected, $input); } /** * @return iterable}> */ public static function provideFix80Cases(): iterable { yield 'with an attribute between PHPDoc and data provider/test method - placement after' => [ <<<'PHP' [ <<<'PHP' 'before'], ]; yield 'data provider defined by an attribute' => [ // update expected once https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/pull/8197 is merged <<<'PHP'