Skip to content

Commit 400cbc9

Browse files
committed
minor #5178 Fix tests (SpacePossum)
This PR was squashed before being merged into the 2.16 branch (closes #5178). Discussion ---------- Fix tests closes #5176 ~~must repeat the process on master as well~~ this should fix master as well after merging upstream 🤞 Commits ------- b1a2b3b Fix tests
2 parents d0f9be5 + b1a2b3b commit 400cbc9

File tree

2 files changed

+32
-65
lines changed

2 files changed

+32
-65
lines changed

tests/Fixer/Casing/ConstantCaseFixerTest.php

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,8 @@ public function provideFixCases()
143143
['<?php echo $null;'],
144144
['<?php $x = False::foo();'],
145145
['<?php namespace Foo\Null;'],
146-
['<?php use Foo\Null;'],
147-
['<?php use Foo\Null as Null;'],
148-
['<?php class True {} class False {} class Null {}'],
149146
['<?php class Foo extends True {}'],
150147
['<?php class Foo implements False {}'],
151-
['<?php Class Null { use True; }'],
152-
['<?php interface True {}'],
153148
['<?php $foo instanceof True; $foo instanceof False; $foo instanceof Null;'],
154149
[
155150
'<?php
@@ -164,18 +159,42 @@ class Foo
164159
['<?php Null/**/::test();'],
165160
['<?php True//
166161
::test();'],
162+
['<?php class Foo { public function Bar() { $this->False = 1; $this->True = 2; $this->Null = 3; } }'],
163+
];
164+
}
165+
166+
/**
167+
* @dataProvider provideFix56Cases
168+
*
169+
* @param string $expected
170+
* @param null|string $input
171+
*
172+
* @requires PHP <7.0
173+
*/
174+
public function testFix56($expected, $input = null)
175+
{
176+
$this->doTest($expected, $input);
177+
}
178+
179+
public function provideFix56Cases()
180+
{
181+
return [
182+
['<?php use Foo\Null;'],
183+
['<?php use Foo\Null as Null;'],
184+
['<?php class True {} class False {} class Null {}'],
185+
['<?php Class Null { use True; }'],
186+
['<?php interface True {}'],
167187
['<?php trait False {}'],
168188
[
169189
'<?php
170-
class Null {
171-
use True, False {
172-
False::bar insteadof True;
173-
True::baz insteadof False;
174-
False::baz as Null;
175-
}
176-
}',
190+
class Null {
191+
use True, False {
192+
False::bar insteadof True;
193+
True::baz insteadof False;
194+
False::baz as Null;
195+
}
196+
}',
177197
],
178-
['<?php class Foo { public function Bar() { $this->False = 1; $this->True = 2; $this->Null = 3; } }'],
179198
];
180199
}
181200
}

tests/Fixer/ClassNotation/FinalStaticAccessFixerTest.php

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -126,56 +126,4 @@ public function c() { return static function(){}; }
126126
],
127127
];
128128
}
129-
130-
/**
131-
* @param string $expected
132-
* @param null|string $input
133-
*
134-
* @dataProvider provideFix70Cases
135-
* @requires PHP 7.0
136-
*/
137-
public function testFix70($expected, $input = null)
138-
{
139-
$this->doTest($expected, $input);
140-
}
141-
142-
public function provideFix70Cases()
143-
{
144-
return [
145-
'property' => [
146-
'<?php final class A { public $b = self::class; }',
147-
'<?php final class A { public $b = static::class; }',
148-
],
149-
'does not change non-final classes' => [
150-
'<?php class A { public $b = static::class; }',
151-
],
152-
'does not change anonymous classes' => [
153-
'<?php $a = new class { public $b = static::class; };',
154-
],
155-
'handles comments' => [
156-
'<?php /*a*/final/*b*/class/*c*/A { public $b = /*1*/self/*2*/::/*3*/class; }',
157-
'<?php /*a*/final/*b*/class/*c*/A { public $b = /*1*/static/*2*/::/*3*/class; }',
158-
],
159-
'property and nested anonymous class' => [
160-
'<?php final class A { public $b = self::class; public function foo(){ return new class { public $b = static::class; }; }}',
161-
'<?php final class A { public $b = static::class; public function foo(){ return new class { public $b = static::class; }; }}',
162-
],
163-
'property and nested anonymous class with set function' => [
164-
'<?php final class A { public $b = self::class; public function foo(){ return new class ($a = function () {}) { public $b = static::class; }; }}',
165-
'<?php final class A { public $b = static::class; public function foo(){ return new class ($a = function () {}) { public $b = static::class; }; }}',
166-
],
167-
'property and nested anonymous class with set anonymous class' => [
168-
'<?php final class A { public $b = self::class; public function foo(){ return new class ($a = new class {}) { public $b = static::class; }; }}',
169-
'<?php final class A { public $b = static::class; public function foo(){ return new class ($a = new class {}) { public $b = static::class; }; }}',
170-
],
171-
'property and nested anonymous class with change after' => [
172-
'<?php final class A { public function foo(){ return new class { public $b = static::class; }; } public $b = self::class; }',
173-
'<?php final class A { public function foo(){ return new class { public $b = static::class; }; } public $b = static::class; }',
174-
],
175-
'property and nested anonymous class with extends' => [
176-
'<?php final class A { public $b = self::class; public function foo(){ return new class extends X implements Y { public $b = static::class; }; }}',
177-
'<?php final class A { public $b = static::class; public function foo(){ return new class extends X implements Y { public $b = static::class; }; }}',
178-
],
179-
];
180-
}
181129
}

0 commit comments

Comments
 (0)