Browse Source

DX: cleanup `PhpdocNoAccessFixerTest` (#7933)

Kuba Werłos 11 months ago
parent
commit
5aae628b5f
2 changed files with 49 additions and 48 deletions
  1. 49 46
      tests/Fixer/Phpdoc/PhpdocNoAccessFixerTest.php
  2. 0 2
      tests/Test/AbstractFixerTestCase.php

+ 49 - 46
tests/Fixer/Phpdoc/PhpdocNoAccessFixerTest.php

@@ -25,61 +25,64 @@ use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
  */
 final class PhpdocNoAccessFixerTest extends AbstractFixerTestCase
 {
-    public function testFixAccess(): void
+    /**
+     * @dataProvider provideFixCases
+     */
+    public function testFix(string $expected, ?string $input = null): void
     {
-        $expected = <<<'EOF'
-            <?php
-                /**
-                 */
-
-            EOF;
-
-        $input = <<<'EOF'
-            <?php
-                /**
-                 * @access public
-                 */
-
-            EOF;
-
         $this->doTest($expected, $input);
     }
 
-    public function testFixMany(): void
+    /**
+     * @return iterable<array{0: string, 1?: string}>
+     */
+    public static function provideFixCases(): iterable
     {
-        $expected = <<<'EOF'
-            <?php
-            /**
-             * Hello!
-             * @notaccess bar
-             */
-
-            EOF;
-
-        $input = <<<'EOF'
-            <?php
-            /**
-             * Hello!
-             * @access private
-             * @notaccess bar
-             * @access foo
-             */
-
-            EOF;
-
-        $this->doTest($expected, $input);
-    }
+        yield 'access' => [
+            <<<'PHP'
+                <?php
+                    /**
+                     */
+
+                PHP,
+            <<<'PHP'
+                <?php
+                    /**
+                     * @access public
+                     */
+
+                PHP
+        ];
+
+        yield 'many' => [
+            <<<'PHP'
+                <?php
+                /**
+                 * Hello!
+                 * @notaccess bar
+                 */
 
-    public function testDoNothing(): void
-    {
-        $expected = <<<'EOF'
-            <?php
+                PHP,
+            <<<'PHP'
+                <?php
                 /**
-                 * @var access
+                 * Hello!
+                 * @access private
+                 * @notaccess bar
+                 * @access foo
                  */
 
-            EOF;
+                PHP
+        ];
+
+        yield 'do nothing' => [
+            <<<'PHP'
+                <?php
+                    /**
+                     * @var access
+                     */
 
-        $this->doTest($expected);
+                PHP
+        ];
     }
 }

+ 0 - 2
tests/Test/AbstractFixerTestCase.php

@@ -65,7 +65,6 @@ use PhpCsFixer\Tests\Fixer\Phpdoc\AlignMultilineCommentFixerTest;
 use PhpCsFixer\Tests\Fixer\Phpdoc\GeneralPhpdocTagRenameFixerTest;
 use PhpCsFixer\Tests\Fixer\Phpdoc\NoBlankLinesAfterPhpdocFixerTest;
 use PhpCsFixer\Tests\Fixer\Phpdoc\PhpdocAddMissingParamAnnotationFixerTest;
-use PhpCsFixer\Tests\Fixer\Phpdoc\PhpdocNoAccessFixerTest;
 use PhpCsFixer\Tests\Fixer\Phpdoc\PhpdocNoAliasTagFixerTest;
 use PhpCsFixer\Tests\Fixer\Phpdoc\PhpdocNoEmptyReturnFixerTest;
 use PhpCsFixer\Tests\Fixer\Phpdoc\PhpdocNoPackageFixerTest;
@@ -489,7 +488,6 @@ abstract class AbstractFixerTestCase extends TestCase
             NoUselessElseFixerTest::class,
             OrderedImportsFixerTest::class,
             PhpdocAddMissingParamAnnotationFixerTest::class,
-            PhpdocNoAccessFixerTest::class,
             PhpdocNoAliasTagFixerTest::class,
             PhpdocNoEmptyReturnFixerTest::class,
             PhpdocNoPackageFixerTest::class,