* 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\Import; use PhpCsFixer\Fixer\Import\GroupImportFixer; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @author Volodymyr Kupriienko * @author Greg Korba * * @internal * * @covers \PhpCsFixer\Fixer\Import\GroupImportFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Import\GroupImportFixer> * * @phpstan-import-type _AutogeneratedInputConfiguration from \PhpCsFixer\Fixer\Import\GroupImportFixer */ final class GroupImportFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideFixCases * * @phpstan-param _AutogeneratedInputConfiguration $config */ public function testFix(string $expected, ?string $input = null, ?array $config = []): void { $this->fixer->configure($config); $this->doTest($expected, $input); } /** * @return iterable */ public static function provideFixCases(): iterable { yield [ ' [ ' [GroupImportFixer::GROUP_CLASSY]], ]; yield 'only functions' => [ ' [GroupImportFixer::GROUP_FUNCTIONS]], ]; yield 'only constants' => [ ' [GroupImportFixer::GROUP_CONSTANTS]], ]; yield 'class-likes and functions' => [ ' [GroupImportFixer::GROUP_CLASSY, GroupImportFixer::GROUP_FUNCTIONS]], ]; yield 'class-likes and constants' => [ ' [GroupImportFixer::GROUP_CLASSY, GroupImportFixer::GROUP_CONSTANTS]], ]; yield 'functions and constants' => [ ' [GroupImportFixer::GROUP_FUNCTIONS, GroupImportFixer::GROUP_CONSTANTS]], ]; } /** * @dataProvider provideFixPre80Cases * * @requires PHP <8.0 */ public function testFixPre80(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } /** * @return iterable */ public static function provideFixPre80Cases(): iterable { yield [ '