* 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\Operator; use PhpCsFixer\ConfigurationException\InvalidFixerConfigurationException; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @author Dariusz Rumiński * * @internal * * @covers \PhpCsFixer\Fixer\Operator\ConcatSpaceFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Operator\ConcatSpaceFixer> * * @phpstan-import-type _AutogeneratedInputConfiguration from \PhpCsFixer\Fixer\Operator\ConcatSpaceFixer */ final class ConcatSpaceFixerTest extends AbstractFixerTestCase { public function testInvalidConfigMissingKey(): void { $this->expectException(InvalidFixerConfigurationException::class); $this->expectExceptionMessageMatches('#^\[concat_space\] Invalid configuration: The option "a" does not exist\. Defined options are: "spacing"\.$#'); $this->fixer->configure(['a' => 1]); } public function testInvalidConfigValue(): void { $this->expectException(InvalidFixerConfigurationException::class); $this->expectExceptionMessageMatches('#^\[concat_space\] Invalid configuration: The option "spacing" with value "tabs" is invalid\. Accepted values are: "one", "none"\.$#'); $this->fixer->configure(['spacing' => 'tabs']); // @phpstan-ignore-line } /** * @dataProvider provideFixWithoutSpaceCases */ public function testFixWithoutSpace(string $expected, ?string $input = null): void { $this->fixer->configure(['spacing' => 'none']); $this->doTest($expected, $input); } /** * @return iterable */ public static function provideFixWithoutSpaceCases(): iterable { yield [ 'fixer->configure(['spacing' => 'one']); $this->doTest($expected, $input); } /** * @return iterable */ public static function provideFixWithSpaceCases(): iterable { yield [ '