Browse Source

DX: PhpUnitDedicateAssertInternalTypeFixer - add code sample for non-default config

Dariusz Ruminski 4 years ago
parent
commit
3044756685

+ 20 - 0
doc/rules/php_unit/php_unit_dedicate_assert_internal_type.rst

@@ -30,6 +30,26 @@ Example #1
 
 *Default* configuration.
 
+.. code-block:: diff
+
+   --- Original
+   +++ New
+   @@ -3,7 +3,7 @@
+    {
+        public function testMe()
+        {
+   -        $this->assertInternalType("array", $var);
+   -        $this->assertInternalType("boolean", $var);
+   +        $this->assertIsArray($var);
+   +        $this->assertIsBool($var);
+        }
+    }
+
+Example #2
+~~~~~~~~~~
+
+With configuration: ``['target' => '7.5']``.
+
 .. code-block:: diff
 
    --- Original

+ 13 - 0
src/Fixer/PhpUnit/PhpUnitDedicateAssertInternalTypeFixer.php

@@ -69,6 +69,19 @@ final class MyTest extends \PHPUnit\Framework\TestCase
 }
 '
                 ),
+                new CodeSample(
+                    '<?php
+final class MyTest extends \PHPUnit\Framework\TestCase
+{
+    public function testMe()
+    {
+        $this->assertInternalType("array", $var);
+        $this->assertInternalType("boolean", $var);
+    }
+}
+',
+                    ['target' => PhpUnitTargetVersion::VERSION_7_5]
+                ),
             ],
             null,
             'Risky when PHPUnit methods are overridden or when project has PHPUnit incompatibilities.'

+ 0 - 1
tests/Test/AbstractFixerTestCase.php

@@ -195,7 +195,6 @@ abstract class AbstractFixerTestCase extends TestCase
             // It may only shrink, never add anything to it.
             $fixerNamesWithKnownMissingSamplesWithConfig = [ // @TODO 3.0 - remove this
                 'is_null', // has only one option which is deprecated
-                'php_unit_dedicate_assert_internal_type',
             ];
 
             if (\count($configSamplesProvided) < 2) {