Browse Source

DX: Enforce consistent naming in tests (#7556)

Kuba Werłos 1 year ago
parent
commit
19474f5260

+ 1 - 1
phpstan.dist.neon

@@ -21,7 +21,7 @@ parameters:
         -
             message: '#^Method PhpCsFixer\\Tests\\.+::provide.+Cases\(\) return type has no value type specified in iterable type iterable\.$#'
             path: tests
-            count: 1113
+            count: 1102
 
         -
             message: '#Call to static method .+ with .+ will always evaluate to true.$#'

+ 4 - 15
tests/Fixer/Alias/NoAliasFunctionsFixerTest.php

@@ -27,10 +27,13 @@ use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
 final class NoAliasFunctionsFixerTest extends AbstractFixerTestCase
 {
     /**
+     * @param array<string, string[]> $configuration
+     *
      * @dataProvider provideFixCases
      */
-    public function testFix(string $expected, ?string $input = null): void
+    public function testFix(string $expected, ?string $input = null, array $configuration = []): void
     {
+        $this->fixer->configure($configuration);
         $this->doTest($expected, $input);
     }
 
@@ -98,21 +101,7 @@ abstract class A
     }
 }',
         ];
-    }
-
-    /**
-     * @param array<string, string[]> $configuration
-     *
-     * @dataProvider provideFixWithConfigurationCases
-     */
-    public function testFixWithConfiguration(string $expected, ?string $input, array $configuration): void
-    {
-        $this->fixer->configure($configuration);
-        $this->doTest($expected, $input);
-    }
 
-    public static function provideFixWithConfigurationCases(): iterable
-    {
         yield '@internal' => [
             '<?php
                 $a = rtrim($b);

+ 54 - 20
tests/Fixer/Alias/NoMixedEchoPrintFixerTest.php

@@ -28,32 +28,43 @@ use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
 final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
 {
     /**
-     * @dataProvider provideFixEchoToPrintCases
+     * @param array<string, mixed> $configuration
+     *
+     * @dataProvider provideFixCases
      */
-    public function testFixEchoToPrint(string $expected, ?string $input = null): void
+    public function testFix(string $expected, ?string $input = null, array $configuration = []): void
     {
-        $this->fixer->configure(['use' => 'print']);
+        $this->fixer->configure($configuration);
         $this->doTest($expected, $input);
     }
 
-    public static function provideFixEchoToPrintCases(): iterable
+    /**
+     * @return iterable<array{string, null|string, array{use: string}}>
+     */
+    public static function provideFixCases(): iterable
     {
         yield [
             '<?php
                 print "test";
                 ',
+            null,
+            ['use' => 'print'],
         ];
 
         yield [
             '<?php
                 print ("test");
                 ',
+            null,
+            ['use' => 'print'],
         ];
 
         yield [
             '<?php
                 print("test");
                 ',
+            null,
+            ['use' => 'print'],
         ];
 
         // `echo` can take multiple parameters (although such usage is rare) while `print` can take only one argument,
@@ -62,6 +73,8 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
             '<?php
                 echo "This ", "string ", "was ", "made ", "with multiple parameters.";
                 ',
+            null,
+            ['use' => 'print'],
         ];
 
         yield [
@@ -71,6 +84,7 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
             '<?php
                 echo "test";
                 ',
+            ['use' => 'print'],
         ];
 
         yield [
@@ -80,6 +94,7 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
             '<?php
                 echo ("test");
                 ',
+            ['use' => 'print'],
         ];
 
         yield [
@@ -89,6 +104,7 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
             '<?php
                 echo("test");
                 ',
+            ['use' => 'print'],
         ];
 
         yield [
@@ -98,6 +114,7 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
             '<?php
                 echo foo(1, 2);
                 ',
+            ['use' => 'print'],
         ];
 
         yield [
@@ -107,6 +124,7 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
             '<?php
                 echo ["foo", "bar", "baz"][$x];
                 ',
+            ['use' => 'print'],
         ];
 
         yield [
@@ -116,11 +134,13 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
             '<?php
                 echo $foo ? "foo" : "bar";
                 ',
+            ['use' => 'print'],
         ];
 
         yield [
             "<?php print 'foo' ?>...<?php echo 'bar', 'baz' ?>",
             "<?php echo 'foo' ?>...<?php echo 'bar', 'baz' ?>",
+            ['use' => 'print'],
         ];
 
         yield [
@@ -136,47 +156,45 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
                 }
                 echo "bar";
                 ',
+            ['use' => 'print'],
         ];
 
         yield [
             '<?=$foo?>',
+            null,
+            ['use' => 'print'],
         ];
 
         foreach (self::getCodeSnippetsToConvertBothWays() as $codeSnippet) {
             yield [
                 sprintf($codeSnippet, 'print'),
                 sprintf($codeSnippet, 'echo'),
+                ['use' => 'print'],
             ];
         }
-    }
 
-    /**
-     * @dataProvider provideFixPrintToEchoCases
-     */
-    public function testFixPrintToEcho(string $expected, ?string $input = null): void
-    {
-        $this->fixer->configure(['use' => 'echo']);
-        $this->doTest($expected, $input);
-    }
-
-    public static function provideFixPrintToEchoCases(): iterable
-    {
         yield [
             '<?php
                 echo "test";
                 ',
+            null,
+            ['use' => 'echo'],
         ];
 
         yield [
             '<?php
                 echo ("test");
                 ',
+            null,
+            ['use' => 'echo'],
         ];
 
         yield [
             '<?php
                 echo("test");
                 ',
+            null,
+            ['use' => 'echo'],
         ];
 
         // https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/1502#issuecomment-156436229
@@ -184,6 +202,8 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
             '<?php
                 ($some_var) ? print "true" : print "false";
                 ',
+            null,
+            ['use' => 'echo'],
         ];
 
         // echo has no return value while print has a return value of 1 so it can be used in expressions.
@@ -192,12 +212,16 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
             '<?php
                 $ret = print "test";
                 ',
+            null,
+            ['use' => 'echo'],
         ];
 
         yield [
             '<?php
                 @print foo();
                 ',
+            null,
+            ['use' => 'echo'],
         ];
 
         yield [
@@ -214,6 +238,8 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
                 switch(print(\'a\')) {}
                 if (1 === print($a)) {}
                 ',
+            null,
+            ['use' => 'echo'],
         ];
 
         yield [
@@ -225,6 +251,7 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
                 some_function_call();
                 print "test";
                 ',
+            ['use' => 'echo'],
         ];
 
         yield [
@@ -234,6 +261,7 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
             '<?php
                 print "test";
                 ',
+            ['use' => 'echo'],
         ];
 
         yield [
@@ -243,6 +271,7 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
             '<?php
                 print ("test");
                 ',
+            ['use' => 'echo'],
         ];
 
         yield [
@@ -252,6 +281,7 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
             '<?php
                 print("test");
                 ',
+            ['use' => 'echo'],
         ];
 
         yield [
@@ -261,6 +291,7 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
             '<?php
                 print foo(1, 2);
                 ',
+            ['use' => 'echo'],
         ];
 
         yield [
@@ -270,6 +301,7 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
             '<?php
                 print $foo ? "foo" : "bar";
                 ',
+            ['use' => 'echo'],
         ];
 
         yield [
@@ -285,17 +317,19 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
                 }
                 print "bar";
                 ',
+            ['use' => 'echo'],
         ];
 
         foreach (self::getCodeSnippetsToConvertBothWays() as $codeSnippet) {
             yield [
                 sprintf($codeSnippet, 'echo'),
                 sprintf($codeSnippet, 'print'),
+                ['use' => 'echo'],
             ];
         }
     }
 
-    public function testDefaultConfig(): void
+    public function testConfigure(): void
     {
         $this->fixer->configure([]);
 
@@ -305,9 +339,9 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
     /**
      * @param array<mixed> $wrongConfig
      *
-     * @dataProvider provideWrongConfigCases
+     * @dataProvider provideInvalidConfigurationCases
      */
-    public function testWrongConfig(array $wrongConfig, string $expectedMessage): void
+    public function testInvalidConfiguration(array $wrongConfig, string $expectedMessage): void
     {
         $this->expectException(InvalidFixerConfigurationException::class);
         $this->expectExceptionMessageMatches($expectedMessage);
@@ -315,7 +349,7 @@ final class NoMixedEchoPrintFixerTest extends AbstractFixerTestCase
         $this->fixer->configure($wrongConfig);
     }
 
-    public static function provideWrongConfigCases(): iterable
+    public static function provideInvalidConfigurationCases(): iterable
     {
         yield [
             ['a' => 'b'],

+ 16 - 27
tests/Fixer/Alias/PowToExponentiationFixerTest.php

@@ -274,6 +274,22 @@ final class PowToExponentiationFixerTest extends AbstractFixerTestCase
             '<?php echo 10_0** 2;',
             '<?php echo pow(10_0, 2);',
         ];
+
+        yield [
+            '<?php pow(); ++$a;++$a;++$a;++$a;++$a;++$a;// pow(1,2);',
+        ];
+
+        yield [
+            '<?php pow(5); ++$a;++$a;++$a;++$a;++$a;++$a;# pow(1,2);',
+        ];
+
+        yield [
+            '<?php pow(5,1,1); ++$a;++$a;++$a;++$a;++$a;++$a;/* pow(1,2); */',
+        ];
+
+        yield [
+            '<?php \a\pow(4,3); ++$a;++$a;++$a;++$a;++$a;++$a;/** pow(1,2); */',
+        ];
     }
 
     /**
@@ -294,33 +310,6 @@ final class PowToExponentiationFixerTest extends AbstractFixerTestCase
         ];
     }
 
-    /**
-     * @dataProvider provideNotFixCases
-     */
-    public function testNotFix(string $expected): void
-    {
-        $this->doTest($expected);
-    }
-
-    public static function provideNotFixCases(): iterable
-    {
-        yield [
-            '<?php pow(); ++$a;++$a;++$a;++$a;++$a;++$a;// pow(1,2);',
-        ];
-
-        yield [
-            '<?php pow(5); ++$a;++$a;++$a;++$a;++$a;++$a;# pow(1,2);',
-        ];
-
-        yield [
-            '<?php pow(5,1,1); ++$a;++$a;++$a;++$a;++$a;++$a;/* pow(1,2); */',
-        ];
-
-        yield [
-            '<?php \a\pow(4,3); ++$a;++$a;++$a;++$a;++$a;++$a;/** pow(1,2); */',
-        ];
-    }
-
     /**
      * @requires PHP 8.0
      *

+ 17 - 7
tests/Fixer/Alias/RandomApiMigrationFixerTest.php

@@ -27,20 +27,30 @@ use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
  */
 final class RandomApiMigrationFixerTest extends AbstractFixerTestCase
 {
-    public function testConfigureCheckSearchFunction(): void
+    /**
+     * @param array<string, mixed> $configuration
+     *
+     * @dataProvider provideInvalidConfigurationCases
+     */
+    public function testInvalidConfiguration(string $message, array $configuration): void
     {
         $this->expectException(InvalidFixerConfigurationException::class);
-        $this->expectExceptionMessageMatches('#^\[random_api_migration\] Invalid configuration: Function "is_null" is not handled by the fixer\.$#');
+        $this->expectExceptionMessage($message);
 
-        $this->fixer->configure(['replacements' => ['is_null' => 'random_int']]);
+        $this->fixer->configure($configuration);
     }
 
-    public function testConfigureCheckReplacementType(): void
+    public static function provideInvalidConfigurationCases(): iterable
     {
-        $this->expectException(InvalidFixerConfigurationException::class);
-        $this->expectExceptionMessageMatches('#^\[random_api_migration\] Invalid configuration: Replacement for function "rand" must be a string, "null" given\.$#');
+        yield 'not supported function' => [
+            '[random_api_migration] Invalid configuration: Function "is_null" is not handled by the fixer.',
+            ['replacements' => ['is_null' => 'random_int']],
+        ];
 
-        $this->fixer->configure(['replacements' => ['rand' => null]]);
+        yield 'wrong replacement' => [
+            '[random_api_migration] Invalid configuration: Replacement for function "rand" must be a string, "null" given.',
+            ['replacements' => ['rand' => null]],
+        ];
     }
 
     public function testConfigure(): void

+ 245 - 100
tests/Fixer/ArrayNotation/ArraySyntaxFixerTest.php

@@ -35,114 +35,259 @@ final class ArraySyntaxFixerTest extends AbstractFixerTestCase
         $this->fixer->configure(['a' => 1]);
     }
 
-    public function testFixWithDefaultConfiguration(): void
-    {
-        $this->fixer->configure([]);
-        $this->doTest(
-            '<?php $a = []; $b = [];',
-            '<?php $a = []; $b = array();'
-        );
-    }
-
     /**
-     * @dataProvider provideFixLongSyntaxCases
+     * @param array<string, mixed> $configuration
+     *
+     * @dataProvider provideFixCases
      */
-    public function testFixLongSyntax(string $expected, ?string $input = null): void
+    public function testFix(string $expected, ?string $input = null, array $configuration = []): void
     {
-        $this->fixer->configure(['syntax' => 'long']);
+        $this->fixer->configure($configuration);
         $this->doTest($expected, $input);
     }
 
-    public static function provideFixLongSyntaxCases(): iterable
-    {
-        yield ['<?php $x = array();', '<?php $x = [];'];
-
-        yield ['<?php $x = array(); $y = array();', '<?php $x = []; $y = [];'];
-
-        yield ['<?php $x = array( );', '<?php $x = [ ];'];
-
-        yield ['<?php $x = array(\'foo\');', '<?php $x = [\'foo\'];'];
-
-        yield ['<?php $x = array( \'foo\' );', '<?php $x = [ \'foo\' ];'];
-
-        yield ['<?php $x = array(($y ? true : false));', '<?php $x = [($y ? true : false)];'];
-
-        yield ['<?php $x = array(($y ? array(true) : array(false)));', '<?php $x = [($y ? [true] : [false])];'];
-
-        yield ['<?php $x = array(($y ? array(true) : array( false )));', '<?php $x = [($y ? [true] : [ false ])];'];
-
-        yield ['<?php $x = array(($y ? array("t" => true) : array("f" => false)));', '<?php $x = [($y ? ["t" => true] : ["f" => false])];'];
-
-        yield ['<?php print_r(array(($y ? true : false)));', '<?php print_r([($y ? true : false)]);'];
-
-        yield ['<?php $x = array(array(array()));', '<?php $x = [[[]]];'];
-
-        yield ['<?php $x = array(array(array())); $y = array(array(array()));', '<?php $x = [[[]]]; $y = [[[]]];'];
-
-        yield ['<?php function(array $foo = array()) {};', '<?php function(array $foo = []) {};'];
-
-        yield ['<?php $x = array(1, 2)[0];', '<?php $x = [1, 2][0];'];
-
-        yield ['<?php $x[] = 1;'];
-
-        yield ['<?php $x[ ] = 1;'];
-
-        yield ['<?php $x[2] = 1;'];
-
-        yield ['<?php $x["a"] = 1;'];
-
-        yield ['<?php $x = func()[$x];'];
-
-        yield ['<?php $x = "foo"[$x];'];
-
-        yield ['<?php $text = "foo ${aaa[123]} bar $bbb[0] baz";'];
-
-        yield ['<?php foreach ($array as [$x, $y]) {}'];
-
-        yield ['<?php foreach ($array as $key => [$x, $y]) {}'];
-    }
-
     /**
-     * @dataProvider provideFixShortSyntaxCases
+     * @return iterable<array{string, null|string, array{syntax?: string}}>
      */
-    public function testFixShortSyntax(string $expected, ?string $input = null): void
-    {
-        $this->fixer->configure(['syntax' => 'short']);
-        $this->doTest($expected, $input);
-    }
-
-    public static function provideFixShortSyntaxCases(): iterable
+    public static function provideFixCases(): iterable
     {
-        yield ['<?php $x = [];', '<?php $x = array();'];
-
-        yield ['<?php $x = []; $y = [];', '<?php $x = array(); $y = array();'];
-
-        yield ['<?php $x = [ ];', '<?php $x = array( );'];
-
-        yield ['<?php $x = [\'foo\'];', '<?php $x = array(\'foo\');'];
-
-        yield ['<?php $x = [ \'foo\' ];', '<?php $x = array( \'foo\' );'];
-
-        yield ['<?php $x = [($y ? true : false)];', '<?php $x = array(($y ? true : false));'];
-
-        yield ['<?php $x = [($y ? [true] : [false])];', '<?php $x = array(($y ? array(true) : array(false)));'];
-
-        yield ['<?php $x = [($y ? [true] : [ false ])];', '<?php $x = array(($y ? array(true) : array( false )));'];
-
-        yield ['<?php $x = [($y ? ["t" => true] : ["f" => false])];', '<?php $x = array(($y ? array("t" => true) : array("f" => false)));'];
-
-        yield ['<?php print_r([($y ? true : false)]);', '<?php print_r(array(($y ? true : false)));'];
-
-        yield ['<?php $x = [[[]]];', '<?php $x = array(array(array()));'];
-
-        yield ['<?php $x = [[[]]]; $y = [[[]]];', '<?php $x = array(array(array())); $y = array(array(array()));'];
-
-        yield ['<?php function(array $foo = []) {};', '<?php function(array $foo = array()) {};'];
-
-        yield ['<?php function(array $foo) {};'];
-
-        yield ['<?php function(array $foo = []) {};', '<?php function(array $foo = array()) {};'];
-
-        yield ['<?php $a  =   [  ];', '<?php $a  =  array (  );'];
+        yield 'default configuration' => [
+            '<?php $a = []; $b = [];',
+            '<?php $a = []; $b = array();',
+            [],
+        ];
+
+        yield [
+            '<?php $x = array();',
+            '<?php $x = [];',
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x = array(); $y = array();',
+            '<?php $x = []; $y = [];',
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x = array( );',
+            '<?php $x = [ ];',
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x = array(\'foo\');',
+            '<?php $x = [\'foo\'];',
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x = array( \'foo\' );',
+            '<?php $x = [ \'foo\' ];',
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x = array(($y ? true : false));',
+            '<?php $x = [($y ? true : false)];',
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x = array(($y ? array(true) : array(false)));',
+            '<?php $x = [($y ? [true] : [false])];',
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x = array(($y ? array(true) : array( false )));',
+            '<?php $x = [($y ? [true] : [ false ])];',
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x = array(($y ? array("t" => true) : array("f" => false)));',
+            '<?php $x = [($y ? ["t" => true] : ["f" => false])];',
+            ['syntax' => 'long'], ];
+
+        yield [
+            '<?php print_r(array(($y ? true : false)));',
+            '<?php print_r([($y ? true : false)]);',
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x = array(array(array()));',
+            '<?php $x = [[[]]];',
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x = array(array(array())); $y = array(array(array()));',
+            '<?php $x = [[[]]]; $y = [[[]]];',
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php function(array $foo = array()) {};',
+            '<?php function(array $foo = []) {};',
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x = array(1, 2)[0];',
+            '<?php $x = [1, 2][0];',
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x[] = 1;',
+            null,
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x[ ] = 1;',
+            null,
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x[2] = 1;',
+            null,
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x["a"] = 1;',
+            null,
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x = func()[$x];',
+            null,
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x = "foo"[$x];',
+            null,
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $text = "foo ${aaa[123]} bar $bbb[0] baz";',
+            null,
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php foreach ($array as [$x, $y]) {}',
+            null,
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php foreach ($array as $key => [$x, $y]) {}',
+            null,
+            ['syntax' => 'long'],
+        ];
+
+        yield [
+            '<?php $x = [];',
+            '<?php $x = array();',
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php $x = []; $y = [];',
+            '<?php $x = array(); $y = array();',
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php $x = [ ];',
+            '<?php $x = array( );',
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php $x = [\'foo\'];',
+            '<?php $x = array(\'foo\');',
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php $x = [ \'foo\' ];',
+            '<?php $x = array( \'foo\' );',
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php $x = [($y ? true : false)];',
+            '<?php $x = array(($y ? true : false));',
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php $x = [($y ? [true] : [false])];',
+            '<?php $x = array(($y ? array(true) : array(false)));',
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php $x = [($y ? [true] : [ false ])];',
+            '<?php $x = array(($y ? array(true) : array( false )));',
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php $x = [($y ? ["t" => true] : ["f" => false])];',
+            '<?php $x = array(($y ? array("t" => true) : array("f" => false)));',
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php print_r([($y ? true : false)]);',
+            '<?php print_r(array(($y ? true : false)));',
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php $x = [[[]]];',
+            '<?php $x = array(array(array()));',
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php $x = [[[]]]; $y = [[[]]];',
+            '<?php $x = array(array(array())); $y = array(array(array()));',
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php function(array $foo = []) {};',
+            '<?php function(array $foo = array()) {};',
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php function(array $foo) {};',
+            null,
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php function(array $foo = []) {};',
+            '<?php function(array $foo = array()) {};',
+            ['syntax' => 'short'],
+        ];
+
+        yield [
+            '<?php $a  =   [  ];',
+            '<?php $a  =  array (  );',
+            ['syntax' => 'short'],
+        ];
     }
 }

+ 162 - 91
tests/Fixer/Basic/NoTrailingCommaInSinglelineFixerTest.php

@@ -24,13 +24,19 @@ use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
 final class NoTrailingCommaInSinglelineFixerTest extends AbstractFixerTestCase
 {
     /**
+     * @param array<string, mixed> $configuration
+     *
      * @dataProvider provideFixCases
      */
-    public function testFix(string $expected, ?string $input = null): void
+    public function testFix(string $expected, ?string $input = null, array $configuration = []): void
     {
+        $this->fixer->configure($configuration);
         $this->doTest($expected, $input);
     }
 
+    /**
+     * @return iterable<array{string, null|string, 2?: array{elements?: array<string>}}>
+     */
     public static function provideFixCases(): iterable
     {
         yield [
@@ -47,93 +53,95 @@ final class NoTrailingCommaInSinglelineFixerTest extends AbstractFixerTestCase
             '<?php $a = [1,[1,[1,[1,[1,[1,[1,[1]],[1,[1,[1,[1,[1,[1,[1,[1]]]]]]]]]]]]]];',
             '<?php $a = [1,[1,[1,[1,[1,[1,[1,[1,],],[1,[1,[1,[1,[1,[1,[1,[1,],],],],],],],],],],],],],];',
         ];
-    }
-
-    /**
-     * @dataProvider provideFixNoTrailingCommaInSinglelineFunctionCallCases
-     */
-    public function testFixNoTrailingCommaInSinglelineFunctionCall(string $expected, string $input = null): void
-    {
-        $this->fixer->configure(['elements' => ['arguments']]);
 
-        $this->doTest($expected, $input);
-    }
-
-    public static function provideFixNoTrailingCommaInSinglelineFunctionCallCases(): iterable
-    {
         yield 'simple var' => [
             '<?php $a(1);',
             '<?php $a(1,);',
+            ['elements' => ['arguments']],
         ];
 
         yield '&' => [
             '<?php $a = &foo($a);',
             '<?php $a = &foo($a,);',
+            ['elements' => ['arguments']],
         ];
 
         yield 'open' => [
             '<?php foo($a);',
             '<?php foo($a,);',
+            ['elements' => ['arguments']],
         ];
 
         yield '=' => [
             '<?php $b = foo($a);',
             '<?php $b = foo($a,);',
+            ['elements' => ['arguments']],
         ];
 
         yield '.' => [
             '<?php $c = $b . foo($a);',
             '<?php $c = $b . foo($a,);',
+            ['elements' => ['arguments']],
         ];
 
         yield '(' => [
             '<?php (foo($a/* 1X */   /* 2 */  ));',
             '<?php (foo($a /* 1X */  , /* 2 */  ));',
+            ['elements' => ['arguments']],
         ];
 
         yield '\\' => [
             '<?php \foo($a);',
             '<?php \foo($a,);',
+            ['elements' => ['arguments']],
         ];
 
         yield 'A\\' => [
             '<?php A\foo($a);',
             '<?php A\foo($a,);',
+            ['elements' => ['arguments']],
         ];
 
         yield '\A\\' => [
             '<?php \A\foo($a);',
             '<?php \A\foo($a,);',
+            ['elements' => ['arguments']],
         ];
 
         yield ';' => [
             '<?php ; foo($a);',
             '<?php ; foo($a,);',
+            ['elements' => ['arguments']],
         ];
 
         yield '}' => [
             '<?php if ($a) { echo 1;} foo($a);',
             '<?php if ($a) { echo 1;} foo($a,);',
+            ['elements' => ['arguments']],
         ];
 
         yield 'test method call' => [
             '<?php $o->abc($a);',
             '<?php $o->abc($a,);',
+            ['elements' => ['arguments']],
         ];
 
         yield 'nested call' => [
             '<?php $o->abc($a,foo(1));',
             '<?php $o->abc($a,foo(1,));',
+            ['elements' => ['arguments']],
         ];
 
         yield 'wrapped' => [
             '<?php echo (new Process())->getOutput(1);',
             '<?php echo (new Process())->getOutput(1,);',
+            ['elements' => ['arguments']],
         ];
 
         yield 'dynamic function and method calls' => [
             '<?php $b->$a(1); $c("");',
             '<?php $b->$a(1,); $c("",);',
+            ['elements' => ['arguments']],
         ];
 
         yield 'static function call' => [
@@ -145,16 +153,19 @@ $b = isset($foo->bar);
 unset($foo->bar,);
 $b = isset($foo->bar,);
 ',
+            ['elements' => ['arguments']],
         ];
 
         yield 'unset' => [
             '<?php A::foo(1);',
             '<?php A::foo(1,);',
+            ['elements' => ['arguments']],
         ];
 
         yield 'anonymous_class construction' => [
             '<?php new class(1, 2) {};',
             '<?php new class(1, 2,) {};',
+            ['elements' => ['arguments']],
         ];
 
         yield 'array/property access call' => [
@@ -194,6 +205,7 @@ ${$e}(1,);
 $$e(2,);
 $f(0,)(1,);
 $g["e"](1,); // foo',
+            ['elements' => ['arguments']],
         ];
 
         yield 'do not fix' => [
@@ -221,77 +233,51 @@ $g["e"](1,); // foo',
                 {
                 }
             ;',
+            null,
+            ['elements' => ['arguments']],
         ];
-    }
 
-    /**
-     * @dataProvider provideFix80NoTrailingCommaInSinglelineFunctionCallFixerCases
-     *
-     * @requires PHP 8.0
-     */
-    public function testFix80NoTrailingCommaInSinglelineFunctionCallFixer(string $expected, string $input = null): void
-    {
-        $this->doTest($expected, $input);
-    }
-
-    public static function provideFix80NoTrailingCommaInSinglelineFunctionCallFixerCases(): iterable
-    {
         yield [
-            '<?php function foo(
-    #[MyAttr(1, 2,)] Type $myParam,
-) {}
-
-$foo1b = function() use ($bar, ) {};
-',
+            '<?php $x = array();',
+            null,
+            ['elements' => ['array']],
         ];
-    }
 
-    /**
-     * @dataProvider provideFix81NoTrailingCommaInSinglelineFunctionCallFixerCases
-     *
-     * @requires PHP 8.1
-     */
-    public function testFix81NoTrailingCommaInSinglelineFunctionCallFixer(string $expected, ?string $input = null): void
-    {
-        $this->doTest($expected, $input);
-    }
-
-    public static function provideFix81NoTrailingCommaInSinglelineFunctionCallFixerCases(): iterable
-    {
         yield [
-            '<?php $object?->method(1); strlen(...);',
-            '<?php $object?->method(1,); strlen(...);',
+            '<?php $x = array("foo");',
+            null,
+            ['elements' => ['array']],
         ];
-    }
-
-    /**
-     * @dataProvider provideFixNoTrailingCommaInSinglelineArrayFixerCases
-     */
-    public function testFixNoTrailingCommaInSinglelineArrayFixer(string $expected, ?string $input = null): void
-    {
-        $this->fixer->configure(['elements' => ['array']]);
-
-        $this->doTest($expected, $input);
-    }
-
-    public static function provideFixNoTrailingCommaInSinglelineArrayFixerCases(): iterable
-    {
-        yield ['<?php $x = array();'];
-
-        yield ['<?php $x = array("foo");'];
 
         yield [
             '<?php $x = array("foo");',
             '<?php $x = array("foo", );',
+            ['elements' => ['array']],
         ];
 
-        yield ["<?php \$x = array(\n'foo', \n);"];
+        yield [
+            "<?php \$x = array(\n'foo', \n);",
+            null,
+            ['elements' => ['array']],
+        ];
 
-        yield ["<?php \$x = array('foo', \n);"];
+        yield [
+            "<?php \$x = array('foo', \n);",
+            null,
+            ['elements' => ['array']],
+        ];
 
-        yield ["<?php \$x = array(array('foo'), \n);", "<?php \$x = array(array('foo',), \n);"];
+        yield [
+            "<?php \$x = array(array('foo'), \n);",
+            "<?php \$x = array(array('foo',), \n);",
+            ['elements' => ['array']],
+        ];
 
-        yield ["<?php \$x = array(array('foo',\n), \n);"];
+        yield [
+            "<?php \$x = array(array('foo',\n), \n);",
+            null,
+            ['elements' => ['array']],
+        ];
 
         yield [
             '<?php
@@ -299,6 +285,8 @@ $foo1b = function() use ($bar, ) {};
         foo
 TWIG
         , $twig, );',
+            null,
+            ['elements' => ['array']],
         ];
 
         yield [
@@ -308,6 +296,8 @@ TWIG
         foo
 TWIG
         , $twig, );',
+            null,
+            ['elements' => ['array']],
         ];
 
         yield [
@@ -316,6 +306,8 @@ TWIG
         foo
 TWIG
         , $twig, );',
+            null,
+            ['elements' => ['array']],
         ];
 
         yield [
@@ -325,26 +317,64 @@ TWIG
         foo
 TWIG
         , $twig, );',
+            null,
+            ['elements' => ['array']],
         ];
 
         // Short syntax
-        yield ['<?php $x = array([]);'];
+        yield [
+            '<?php $x = array([]);',
+            null,
+            ['elements' => ['array']],
+        ];
 
-        yield ['<?php $x = [[]];'];
+        yield [
+            '<?php $x = [[]];',
+            null,
+            ['elements' => ['array']],
+        ];
 
-        yield ['<?php $x = ["foo"];', '<?php $x = ["foo",];'];
+        yield [
+            '<?php $x = ["foo"];',
+            '<?php $x = ["foo",];',
+            ['elements' => ['array']],
+        ];
 
-        yield ['<?php $x = bar(["foo"]);', '<?php $x = bar(["foo",]);'];
+        yield [
+            '<?php $x = bar(["foo"]);',
+            '<?php $x = bar(["foo",]);',
+            ['elements' => ['array']],
+        ];
 
-        yield ["<?php \$x = bar([['foo'],\n]);"];
+        yield [
+            "<?php \$x = bar([['foo'],\n]);",
+            null,
+            ['elements' => ['array']],
+        ];
 
-        yield ["<?php \$x = ['foo', \n];"];
+        yield [
+            "<?php \$x = ['foo', \n];",
+            null,
+            ['elements' => ['array']],
+        ];
 
-        yield ['<?php $x = array([]);', '<?php $x = array([],);'];
+        yield [
+            '<?php $x = array([]);',
+            '<?php $x = array([],);',
+            ['elements' => ['array']],
+        ];
 
-        yield ['<?php $x = [[]];', '<?php $x = [[],];'];
+        yield [
+            '<?php $x = [[]];',
+            '<?php $x = [[],];',
+            ['elements' => ['array']],
+        ];
 
-        yield ['<?php $x = [$y[""]];', '<?php $x = [$y[""],];'];
+        yield [
+            '<?php $x = [$y[""]];',
+            '<?php $x = [$y[""],];',
+            ['elements' => ['array']],
+        ];
 
         yield [
             '<?php
@@ -352,6 +382,8 @@ TWIG
         foo
 TWIG
         , $twig, ];',
+            null,
+            ['elements' => ['array']],
         ];
 
         yield [
@@ -361,6 +393,8 @@ TWIG
         foo
 TWIG
         , $twig, ];',
+            null,
+            ['elements' => ['array']],
         ];
 
         yield [
@@ -369,6 +403,8 @@ TWIG
         foo
 TWIG
         , $twig, ];',
+            null,
+            ['elements' => ['array']],
         ];
 
         yield [
@@ -378,31 +414,22 @@ TWIG
         foo
 TWIG
         , $twig, ];',
+            null,
+            ['elements' => ['array']],
         ];
 
         yield [
             '<?php $x = array(...$foo);',
             '<?php $x = array(...$foo, );',
+            ['elements' => ['array']],
         ];
 
         yield [
             '<?php $x = [...$foo];',
             '<?php $x = [...$foo, ];',
+            ['elements' => ['array']],
         ];
-    }
-
-    /**
-     * @dataProvider provideFixNoTrailingCommaInListCallFixerCases
-     */
-    public function testFixNoTrailingCommaInListCallFixer(string $expected, ?string $input = null): void
-    {
-        $this->fixer->configure(['elements' => ['array_destructuring']]);
 
-        $this->doTest($expected, $input);
-    }
-
-    public static function provideFixNoTrailingCommaInListCallFixerCases(): iterable
-    {
         yield [
             '<?php
 list($a1, $b) = foo();
@@ -420,6 +447,7 @@ list($a4, , , , , ) = foo();
 list($a5 , $b , ) = foo();
 list($a6, /* $b */, $c, ) = foo();
 ',
+            ['elements' => ['array_destructuring']],
         ];
 
         yield [
@@ -429,6 +457,8 @@ $a#
 ,#
 #
 ) = $a;',
+            null,
+            ['elements' => ['array_destructuring']],
         ];
 
         yield [
@@ -448,6 +478,47 @@ $a#
 [$a11 , $b , ] = foo();
 [$a12, /* $b */, $c, ] = foo();
 ',
+            ['elements' => ['array_destructuring']],
+        ];
+    }
+
+    /**
+     * @dataProvider provideFix80Cases
+     *
+     * @requires PHP 8.0
+     */
+    public function testFix80(string $expected, string $input = null): void
+    {
+        $this->doTest($expected, $input);
+    }
+
+    public static function provideFix80Cases(): iterable
+    {
+        yield [
+            '<?php function foo(
+    #[MyAttr(1, 2,)] Type $myParam,
+) {}
+
+$foo1b = function() use ($bar, ) {};
+',
+        ];
+    }
+
+    /**
+     * @dataProvider provideFix81Cases
+     *
+     * @requires PHP 8.1
+     */
+    public function testFix81(string $expected, ?string $input = null): void
+    {
+        $this->doTest($expected, $input);
+    }
+
+    public static function provideFix81Cases(): iterable
+    {
+        yield [
+            '<?php $object?->method(1); strlen(...);',
+            '<?php $object?->method(1,); strlen(...);',
         ];
     }
 }

+ 43 - 30
tests/Fixer/Basic/NonPrintableCharacterFixerTest.php

@@ -26,34 +26,25 @@ use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
 final class NonPrintableCharacterFixerTest extends AbstractFixerTestCase
 {
     /**
+     * @param array<string, mixed> $configuration
+     *
      * @dataProvider provideFixCases
      */
-    public function testFix(string $expected, ?string $input = null): void
+    public function testFix(string $expected, ?string $input = null, array $configuration = []): void
     {
-        $this->fixer->configure([
-            'use_escape_sequences_in_strings' => false,
-        ]);
-
+        $this->fixer->configure($configuration);
         $this->doTest($expected, $input);
     }
 
     /**
-     * @dataProvider provideFixCases
+     * @return iterable<array{string, null|string, array{use_escape_sequences_in_strings: bool}}>
      */
-    public function testFixWithoutEscapeSequences(string $expected, ?string $input = null): void
-    {
-        $this->fixer->configure([
-            'use_escape_sequences_in_strings' => false,
-        ]);
-
-        $this->doTest($expected, $input);
-    }
-
     public static function provideFixCases(): iterable
     {
         yield [
             '<?php echo "Hello World !";',
             '<?php echo "'.pack('H*', 'e2808b').'Hello'.pack('H*', 'e28087').'World'.pack('H*', 'c2a0').'!";',
+            ['use_escape_sequences_in_strings' => false],
         ];
 
         yield [
@@ -66,6 +57,7 @@ final class NonPrintableCharacterFixerTest extends AbstractFixerTestCase
                 pack('H*', 'e2808b').
                 pack('H*', 'e2808b').
             'Hello World !";',
+            ['use_escape_sequences_in_strings' => false],
         ];
 
         yield [
@@ -75,6 +67,7 @@ echo "Hello World !";',
             '<?php
 // ec'.pack('H*', 'e2808b').'ho
 echo "Hello'.pack('H*', 'e280af').'World'.pack('H*', 'c2a0').'!";',
+            ['use_escape_sequences_in_strings' => false],
         ];
 
         yield [
@@ -96,54 +89,51 @@ echo "Hello'.pack('H*', 'e280af').'World'.pack('H*', 'c2a0').'!";',
                 {
                     echo $p;
                 }',
+            ['use_escape_sequences_in_strings' => false],
         ];
 
         yield [
             '<?php echo "$a[0] ${a}";',
             '<?php echo "$a'.pack('H*', 'e2808b').'[0]'.pack('H*', 'e2808b').' ${a'.pack('H*', 'e2808b').'}";',
+            ['use_escape_sequences_in_strings' => false],
         ];
 
         yield [
             '<?php echo \'12345\';?>abc<?php ?>',
             '<?php echo \'123'.pack('H*', 'e2808b').'45\';?>a'.pack('H*', 'e2808b').'bc<?php ?>',
+            ['use_escape_sequences_in_strings' => false],
         ];
 
         yield [
             '<?php echo "${foo'.pack('H*', 'c2a0').'bar} is great!";',
+            null,
+            ['use_escape_sequences_in_strings' => false],
         ];
 
         yield [
             '<?php echo $foo'.pack('H*', 'c2a0').'bar;',
+            null,
+            ['use_escape_sequences_in_strings' => false],
         ];
 
         yield [
             '<?php /* foo *'.pack('H*', 'e2808b').'/ bar */',
+            null,
+            ['use_escape_sequences_in_strings' => false],
         ];
 
         yield [
             '<?php /** foo *'.pack('H*', 'e2808b').'/ bar */',
+            null,
+            ['use_escape_sequences_in_strings' => false],
         ];
 
         yield [
             '<?php echo b"Hello World !";',
             '<?php echo b"'.pack('H*', 'e2808b').'Hello'.pack('H*', 'e28087').'World'.pack('H*', 'c2a0').'!";',
+            ['use_escape_sequences_in_strings' => false],
         ];
-    }
 
-    /**
-     * @dataProvider provideFixWithEscapeSequencesInStringsCases
-     */
-    public function testFixWithEscapeSequencesInStrings(string $expected, ?string $input = null): void
-    {
-        $this->fixer->configure([
-            'use_escape_sequences_in_strings' => true,
-        ]);
-
-        $this->doTest($expected, $input);
-    }
-
-    public static function provideFixWithEscapeSequencesInStringsCases(): iterable
-    {
         yield [
             '<?php
 
@@ -163,25 +153,31 @@ echo "Hello'.pack('H*', 'e280af').'World'.pack('H*', 'c2a0').'!";',
                 {
                     echo $p;
                 }',
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
             '<?php echo \'FooBar\\\\\';',
+            null,
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
             '<?php echo "Foo\u{200b}Bar";',
             '<?php echo "Foo'.pack('H*', 'e2808b').'Bar";',
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
             '<?php echo "Foo\u{200b}Bar";',
             '<?php echo \'Foo'.pack('H*', 'e2808b').'Bar\';',
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
             '<?php echo "Foo\u{200b} Bar \\\\n \\\\ \$variableToEscape";',
             '<?php echo \'Foo'.pack('H*', 'e2808b').' Bar \n \ $variableToEscape\';',
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
@@ -189,6 +185,8 @@ echo "Hello'.pack('H*', 'e280af').'World'.pack('H*', 'c2a0').'!";',
 FooBar\
 TXT;
 ',
+            null,
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
@@ -200,6 +198,7 @@ TXT;
 Foo'.pack('H*', 'e2808b').'Bar
 TXT;
 ',
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
@@ -211,6 +210,7 @@ TXT;
 Foo'.pack('H*', 'e2808b').'Bar
 TXT;
 ',
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
@@ -222,10 +222,13 @@ TXT;
 Foo'.pack('H*', 'e2808b').' Bar \n \ $variableToEscape
 TXT;
 ',
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
             '<?php echo \'。\';',
+            null,
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
@@ -240,6 +243,7 @@ TXT;
                 ,
                 pack('H*', 'e2808b')
             ),
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
@@ -254,6 +258,7 @@ TXT;
                 ,
                 pack('H*', 'e2808b')
             ),
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
@@ -274,6 +279,7 @@ TXT;
                 ,
                 pack('H*', 'e2808b')
             ),
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
@@ -288,6 +294,7 @@ TXT;
                 ,
                 pack('H*', 'e2808b')
             ),
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
@@ -302,6 +309,7 @@ TXT;
                 ,
                 pack('H*', 'e2808b')
             ),
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
@@ -316,6 +324,7 @@ TXT;
                 ,
                 pack('H*', 'e2808b')
             ),
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
@@ -330,6 +339,7 @@ TXT;
                 ,
                 pack('H*', 'e2808b')
             ),
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
@@ -344,6 +354,7 @@ TXT;
                 ,
                 pack('H*', 'e2808b')
             ),
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
@@ -358,11 +369,13 @@ TXT;
                 ,
                 pack('H*', 'e2808b')
             ),
+            ['use_escape_sequences_in_strings' => true],
         ];
 
         yield [
             "<?php \"String in single quotes, having non-breaking space: \\u{a0}, linebreak: \n, and single quote inside: ' is a dangerous mix.\";",
             "<?php 'String in single quotes, having non-breaking space: ".pack('H*', 'c2a0').", linebreak: \n, and single quote inside: \\' is a dangerous mix.';",
+            ['use_escape_sequences_in_strings' => true],
         ];
     }
 }

+ 16 - 0
tests/Fixer/Casing/NativeFunctionTypeDeclarationCasingFixerTest.php

@@ -34,4 +34,20 @@ final class NativeFunctionTypeDeclarationCasingFixerTest extends AbstractFixerTe
             $fixer->getSuccessorsNames(),
         );
     }
+
+    /**
+     * @dataProvider provideFixCases
+     */
+    public function testFix(string $expected, ?string $input = null): void
+    {
+        $this->doTest($expected, $input);
+    }
+
+    /**
+     * @return iterable<array{string, null|string}>
+     */
+    public static function provideFixCases(): iterable
+    {
+        yield from NativeTypeDeclarationCasingFixerTest::provideFixCases();
+    }
 }

+ 68 - 0
tests/Test/AbstractFixerTestCase.php

@@ -372,6 +372,74 @@ abstract class AbstractFixerTestCase extends TestCase
         }
     }
 
+    final public function testProperMethodNaming(): void
+    {
+        if ($this->fixer instanceof DeprecatedFixerInterface) {
+            self::markTestSkipped('Not worth refactoring tests for deprecated fixers.');
+        }
+
+        $exceptionGroup = [
+            'Casing',
+            'CastNotation',
+            'ClassNotation',
+            'ClassUsage',
+            'Comment',
+            'ConstantNotation',
+            'ControlStructure',
+            'DoctrineAnnotation',
+            'FunctionNotation',
+            'Import',
+            'LanguageConstruct',
+            'ListNotation',
+            'NamespaceNotation',
+            'Naming',
+            'Operator',
+            'PhpTag',
+            'PhpUnit',
+            'Phpdoc',
+            'ReturnNotation',
+            'Semicolon',
+            'Strict',
+            'StringNotation',
+            'Whitespace',
+        ];
+
+        $fixerGroup = explode('\\', static::class)[3];
+
+        if (\in_array($fixerGroup, $exceptionGroup, true)) {
+            self::markTestSkipped('Not covered yet.');
+        }
+
+        self::assertTrue(method_exists($this, 'testFix'), 'Method testFix does not exist.');
+        self::assertTrue(method_exists($this, 'provideFixCases'), 'Method provideFixCases does not exist.');
+
+        $names = ['Fix', 'FixPre80', 'Fix80', 'Fix81', 'Fix82', 'Fix83', 'InvalidConfiguration'];
+        $methodNames = ['testConfigure'];
+        foreach ($names as $name) {
+            $methodNames[] = 'test'.$name;
+            $methodNames[] = 'provide'.$name.'Cases';
+        }
+
+        $class = new \ReflectionObject($this);
+
+        $extraMethods = [];
+        foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
+            if ($method->getDeclaringClass()->getName() !== $class->getName()) {
+                continue;
+            }
+            if (\in_array($method->getName(), $methodNames, true)) {
+                continue;
+            }
+            $extraMethods[] = $method->getName();
+        }
+
+        self::assertSame(
+            [],
+            $extraMethods,
+            sprintf('Methods "%s" should not be present.', implode('". "', $extraMethods)),
+        );
+    }
+
     protected function createFixer(): AbstractFixer
     {
         $fixerClassName = preg_replace('/^(PhpCsFixer)\\\\Tests(\\\\.+)Test$/', '$1$2', static::class);