* 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\Phpdoc; use PhpCsFixer\ConfigurationException\InvalidFixerConfigurationException; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; use PhpCsFixer\WhitespacesFixerConfig; /** * @author Filippo Tessarotto * * @internal * * @covers \PhpCsFixer\Fixer\Phpdoc\AlignMultilineCommentFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Phpdoc\AlignMultilineCommentFixer> * * @phpstan-import-type _AutogeneratedInputConfiguration from \PhpCsFixer\Fixer\Phpdoc\AlignMultilineCommentFixer */ final class AlignMultilineCommentFixerTest extends AbstractFixerTestCase { public function testInvalidConfiguration(): void { $this->expectException(InvalidFixerConfigurationException::class); $this->fixer->configure(['a' => 1]); } /** * @dataProvider provideDefaultCases */ public function testDefaults(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } /** * @return iterable */ public static function provideDefaultCases(): iterable { yield [ ' [ 'fixer->configure(['comment_type' => 'phpdocs_like']); $this->doTest($expected, $input); } /** * @return iterable */ public static function provideDocLikeMultilineCommentsCases(): iterable { yield [ 'fixer->configure(['comment_type' => 'all_multiline']); $this->doTest($expected, $input); } /** * @return iterable */ public static function provideMixedContentMultilineCommentsCases(): iterable { yield [ 'fixer->setWhitespacesConfig(new WhitespacesFixerConfig("\t", "\r\n")); $expected = str_replace("\n", "\r\n", $expected); if (null !== $input) { $input = str_replace("\n", "\r\n", $input); } $this->doTest($expected, $input); } }