Browse Source

minor #5178 Fix tests (SpacePossum)

This PR was squashed before being merged into the 2.16 branch (closes #5178).

Discussion
----------

Fix tests

closes https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/5176

~~must repeat the process on master as well~~
this should fix master as well after merging upstream :crossed_fingers:

Commits
-------

b1a2b3b5e Fix tests
SpacePossum 4 years ago
parent
commit
400cbc9846

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

@@ -143,13 +143,8 @@ final class ConstantCaseFixerTest extends AbstractFixerTestCase
             ['<?php echo $null;'],
             ['<?php $x = False::foo();'],
             ['<?php namespace Foo\Null;'],
-            ['<?php use Foo\Null;'],
-            ['<?php use Foo\Null as Null;'],
-            ['<?php class True {} class False {} class Null {}'],
             ['<?php class Foo extends True {}'],
             ['<?php class Foo implements False {}'],
-            ['<?php Class Null { use True; }'],
-            ['<?php interface True {}'],
             ['<?php $foo instanceof True; $foo instanceof False; $foo instanceof Null;'],
             [
                 '<?php
@@ -164,18 +159,42 @@ final class ConstantCaseFixerTest extends AbstractFixerTestCase
             ['<?php Null/**/::test();'],
             ['<?php True//
                                 ::test();'],
+            ['<?php class Foo { public function Bar() { $this->False = 1; $this->True = 2; $this->Null = 3; } }'],
+        ];
+    }
+
+    /**
+     * @dataProvider provideFix56Cases
+     *
+     * @param string      $expected
+     * @param null|string $input
+     *
+     * @requires PHP <7.0
+     */
+    public function testFix56($expected, $input = null)
+    {
+        $this->doTest($expected, $input);
+    }
+
+    public function provideFix56Cases()
+    {
+        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;
-        }
-    }',
+                class Null {
+                    use True, False {
+                        False::bar insteadof True;
+                        True::baz insteadof False;
+                        False::baz as Null;
+                    }
+                }',
             ],
-            ['<?php class Foo { public function Bar() { $this->False = 1; $this->True = 2; $this->Null = 3; } }'],
         ];
     }
 }

+ 0 - 52
tests/Fixer/ClassNotation/FinalStaticAccessFixerTest.php

@@ -126,56 +126,4 @@ final class FinalStaticAccessFixerTest extends AbstractFixerTestCase
             ],
         ];
     }
-
-    /**
-     * @param string      $expected
-     * @param null|string $input
-     *
-     * @dataProvider provideFix70Cases
-     * @requires PHP 7.0
-     */
-    public function testFix70($expected, $input = null)
-    {
-        $this->doTest($expected, $input);
-    }
-
-    public function provideFix70Cases()
-    {
-        return [
-            'property' => [
-                '<?php final class A { public $b = self::class; }',
-                '<?php final class A { public $b = static::class; }',
-            ],
-            'does not change non-final classes' => [
-                '<?php class A { public $b = static::class; }',
-            ],
-            'does not change anonymous classes' => [
-                '<?php $a = new class { public $b = static::class; };',
-            ],
-            'handles comments' => [
-                '<?php /*a*/final/*b*/class/*c*/A { public $b = /*1*/self/*2*/::/*3*/class; }',
-                '<?php /*a*/final/*b*/class/*c*/A { public $b = /*1*/static/*2*/::/*3*/class; }',
-            ],
-            'property and nested anonymous class' => [
-                '<?php final class A { public $b = self::class; public function foo(){ return new class { public $b = static::class; }; }}',
-                '<?php final class A { public $b = static::class; public function foo(){ return new class { public $b = static::class; }; }}',
-            ],
-            'property and nested anonymous class with set function' => [
-                '<?php final class A { public $b = self::class; public function foo(){ return new class ($a = function () {}) { public $b = static::class; }; }}',
-                '<?php final class A { public $b = static::class; public function foo(){ return new class ($a = function () {}) { public $b = static::class; }; }}',
-            ],
-            'property and nested anonymous class with set anonymous class' => [
-                '<?php final class A { public $b = self::class; public function foo(){ return new class ($a = new class {}) { public $b = static::class; }; }}',
-                '<?php final class A { public $b = static::class; public function foo(){ return new class ($a = new class {}) { public $b = static::class; }; }}',
-            ],
-            'property and nested anonymous class with change after' => [
-                '<?php final class A { public function foo(){ return new class { public $b = static::class; }; } public $b = self::class; }',
-                '<?php final class A { public function foo(){ return new class { public $b = static::class; }; } public $b = static::class; }',
-            ],
-            'property and nested anonymous class with extends' => [
-                '<?php final class A { public $b = self::class; public function foo(){ return new class extends X implements Y { public $b = static::class; }; }}',
-                '<?php final class A { public $b = static::class; public function foo(){ return new class extends X implements Y { public $b = static::class; }; }}',
-            ],
-        ];
-    }
 }