Browse Source

Clean up test based on PHP requirements

SpacePossum 3 years ago
parent
commit
44f272e753

+ 0 - 14
tests/Fixer/Basic/NonPrintableCharacterFixerTest.php

@@ -14,7 +14,6 @@ declare(strict_types=1);
 
 namespace PhpCsFixer\Tests\Fixer\Basic;
 
-use PhpCsFixer\ConfigurationException\InvalidForEnvFixerConfigurationException;
 use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
 
 /**
@@ -294,17 +293,4 @@ INPUT
             ],
         ];
     }
-
-    /**
-     * @requires PHP <7.0
-     */
-    public function testFixWithEscapeSequencesInStringsLowerThanPhp70(): void
-    {
-        $this->expectException(InvalidForEnvFixerConfigurationException::class);
-        $this->expectExceptionMessageMatches('/^\[non_printable_character\] Invalid configuration for env: Escape sequences require PHP 7\.0\+\.$/');
-
-        $this->fixer->configure([
-            'use_escape_sequences_in_strings' => true,
-        ]);
-    }
 }

+ 0 - 32
tests/Fixer/Casing/ConstantCaseFixerTest.php

@@ -156,38 +156,6 @@ final class ConstantCaseFixerTest extends AbstractFixerTestCase
         ];
     }
 
-    /**
-     * @dataProvider provideFix56Cases
-     *
-     * @requires PHP <7.0
-     */
-    public function testFix56(string $expected, ?string $input = null): void
-    {
-        $this->doTest($expected, $input);
-    }
-
-    public function provideFix56Cases(): array
-    {
-        return [
-            ['<?php use Foo\Null;'],
-            ['<?php use Foo\Null as Null;'],
-            ['<?php class True {} class False {} class Null {}'],
-            ['<?php Class Null { use True; }'],
-            ['<?php interface True {}'],
-            ['<?php trait False {}'],
-            [
-                '<?php
-                class Null {
-                    use True, False {
-                        False::bar insteadof True;
-                        True::baz insteadof False;
-                        False::baz as Null;
-                    }
-                }',
-            ],
-        ];
-    }
-
     /**
      * @dataProvider provideFix80Cases
      * @requires PHP 8.0

+ 0 - 15
tests/Fixer/Casing/LowercaseStaticReferenceFixerTest.php

@@ -156,21 +156,6 @@ final class LowercaseStaticReferenceFixerTest extends AbstractFixerTestCase
             [
                 '<?php class Foo extends Bar { public function baz() : Self\Qux {} }',
             ],
-        ];
-    }
-
-    /**
-     * @requires PHP 7.1
-     * @dataProvider provideFix71Cases
-     */
-    public function testFix71(string $expected, ?string $input = null): void
-    {
-        $this->doTest($expected, $input);
-    }
-
-    public function provideFix71Cases(): array
-    {
-        return [
             [
                 '<?php class Foo extends Bar { public function baz(?self $x) {} }',
                 '<?php class Foo extends Bar { public function baz(?Self $x) {} }',

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

@@ -108,21 +108,6 @@ function Foo(INTEGER $a) {}
             [
                 '<?php function Foo(): Foo\A { return new Foo(); }',
             ],
-        ];
-    }
-
-    /**
-     * @dataProvider provideFix71Cases
-     * @requires PHP 7.1
-     */
-    public function testFix71(string $expected, string $input): void
-    {
-        $this->doTest($expected, $input);
-    }
-
-    public function provideFix71Cases(): array
-    {
-        return [
             [
                 '<?php trait XYZ { function Foo(iterable $A): void {} }',
                 '<?php trait XYZ { function Foo(ITERABLE $A): VOID {} }',

+ 0 - 15
tests/Fixer/ClassNotation/NoNullPropertyInitializationFixerTest.php

@@ -273,21 +273,6 @@ null;#13
             [
                 '<?php function foo() { return new class() { public function foo() { static $foo = null; } }; }',
             ],
-        ];
-    }
-
-    /**
-     * @requires PHP 7.1
-     * @dataProvider providePhp71Cases
-     */
-    public function testFixPhp71(string $expected, ?string $input = null): void
-    {
-        $this->doTest($expected, $input);
-    }
-
-    public function providePhp71Cases(): array
-    {
-        return [
             [
                 '<?php class Foo { public const FOO = null; }',
             ],

+ 0 - 15
tests/Fixer/ClassNotation/SelfAccessorFixerTest.php

@@ -158,21 +158,6 @@ final class SelfAccessorFixerTest extends AbstractFixerTestCase
                 '<?php interface Foo { public function bar(self $foo, self $bar): self; }',
                 '<?php interface Foo { public function bar(Foo $foo, Foo $bar): Foo; }',
             ],
-        ];
-    }
-
-    /**
-     * @dataProvider provideFix71Cases
-     * @requires PHP 7.1
-     */
-    public function testFix71(string $expected, ?string $input = null): void
-    {
-        $this->doTest($expected, $input);
-    }
-
-    public function provideFix71Cases(): array
-    {
-        return [
             [
                 '<?php class Foo { public function bar(?self $foo, ?self $bar): ?self { return new self(); } }',
                 '<?php class Foo { public function bar(?Foo $foo, ?Foo $bar): ?Foo { return new Foo(); } }',

+ 19 - 34
tests/Fixer/ClassNotation/SingleClassElementPerStatementFixerTest.php

@@ -614,6 +614,25 @@ B#
 echo Foo::A, Foo::B;
 ',
             ],
+            [
+                '<?php
+                    class Token {
+                        const PUBLIC_CONST = 0;
+                        private const PRIVATE_CONST = 0;
+                        protected const PROTECTED_CONST = 0;
+                        public const PUBLIC_CONST_TWO = 0;
+                        public const TEST_71 = 0;
+                    }
+                ',
+                '<?php
+                    class Token {
+                        const PUBLIC_CONST = 0;
+                        private const PRIVATE_CONST = 0;
+                        protected const PROTECTED_CONST = 0;
+                        public const PUBLIC_CONST_TWO = 0, TEST_71 = 0;
+                    }
+                ',
+            ],
         ];
     }
 
@@ -690,40 +709,6 @@ EOT
         $this->fixer->configure(['elements' => ['foo']]);
     }
 
-    /**
-     * @dataProvider providePHP71Cases
-     * @requires PHP 7.1
-     */
-    public function testPHP71(string $expected, string $input): void
-    {
-        $this->doTest($expected, $input);
-    }
-
-    public function providePHP71Cases(): array
-    {
-        return [
-            [
-                '<?php
-                    class Token {
-                        const PUBLIC_CONST = 0;
-                        private const PRIVATE_CONST = 0;
-                        protected const PROTECTED_CONST = 0;
-                        public const PUBLIC_CONST_TWO = 0;
-                        public const TEST_71 = 0;
-                    }
-                ',
-                '<?php
-                    class Token {
-                        const PUBLIC_CONST = 0;
-                        private const PRIVATE_CONST = 0;
-                        protected const PROTECTED_CONST = 0;
-                        public const PUBLIC_CONST_TWO = 0, TEST_71 = 0;
-                    }
-                ',
-            ],
-        ];
-    }
-
     /**
      * @dataProvider provideMessyWhitespacesCases
      */

+ 0 - 12
tests/Fixer/ClassNotation/VisibilityRequiredFixerTest.php

@@ -501,15 +501,6 @@ EOF;
         $this->doTest($expected, $input);
     }
 
-    /**
-     * @requires PHP <7.1
-     */
-    public function testIgnoreConstants(): void
-    {
-        $this->fixer->configure(['elements' => ['const']]);
-        $this->doTest('<?php class A { const B=1; }');
-    }
-
     public function testInvalidConfigurationType(): void
     {
         $this->expectException(InvalidFixerConfigurationException::class);
@@ -675,9 +666,6 @@ AB# <- this is the name
         );
     }
 
-    /**
-     * @requires PHP 7.1
-     */
     public function testKeepingComment(): void
     {
         $this->fixer->configure(['elements' => ['property', 'method', 'const']]);

+ 0 - 16
tests/Fixer/ConstantNotation/NativeConstantInvocationFixerTest.php

@@ -166,22 +166,6 @@ final class NativeConstantInvocationFixerTest extends AbstractFixerTestCase
             ],
             ['<?php function foo(): M_PI {}'],
             ['<?php use X\Y\{FOO, BAR as BAR2, M_PI};'],
-        ];
-    }
-
-    /**
-     * @dataProvider provideFix71WithDefaultConfigurationCases
-     *
-     * @requires PHP 7.1
-     */
-    public function testFix71WithDefaultConfiguration(string $expected, ?string $input = null): void
-    {
-        $this->doTest($expected, $input);
-    }
-
-    public function provideFix71WithDefaultConfigurationCases(): array
-    {
-        return [
             [
                 '<?php
 try {

+ 0 - 12
tests/Fixer/ControlStructure/NoUselessElseFixerTest.php

@@ -744,19 +744,7 @@ else?><?php echo 5;',
 
                 return $ret;',
         ];
-    }
-
-    /**
-     * @dataProvider provideConditionsWithoutBraces70Cases
-     * @requires PHP 7.0
-     */
-    public function testConditionsWithoutBraces70(string $expected): void
-    {
-        $this->doTest($expected);
-    }
 
-    public function provideConditionsWithoutBraces70Cases(): \Generator
-    {
         yield from $this->generateConditionsWithoutBracesCase('throw new class extends Exception{};');
         yield from $this->generateConditionsWithoutBracesCase('throw new class ($a, 9) extends Exception{ public function z($a, $b){ echo 7;} };');
     }

Some files were not shown because too many files changed in this diff