Skip to content

Commit 609b6fa

Browse files
committed
Update tests
1 parent 271d209 commit 609b6fa

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

.dev-tools/infection.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@
134134
"Ternary": true,
135135
"This": true,
136136
"Throw_": true,
137-
"TrueValue": true,
137+
"TrueValue": {
138+
"ignore": [
139+
"PhpCsFixerCustomFixers\\Fixer\\ClassConstantUsageFixer::getClassConstants"
140+
]
141+
},
138142
"UnwrapArrayChangeKeyCase": true,
139143
"UnwrapArrayChunk": true,
140144
"UnwrapArrayColumn": true,

.dev-tools/src/InfectionConfigBuilder.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ public function build(): array
9494
],
9595
];
9696

97+
$config['mutators']['TrueValue'] = [
98+
'ignore' => [
99+
'PhpCsFixerCustomFixers\\Fixer\\ClassConstantUsageFixer::getClassConstants',
100+
],
101+
];
102+
97103
return $config;
98104
}
99105
}

tests/Fixer/ClassConstantUsageFixerTest.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public function f()
5050
}
5151
PHP,
5252
];
53+
5354
yield 'multiple constants with the same value' => [
5455
<<<'PHP'
5556
<?php
@@ -68,26 +69,28 @@ public function f()
6869
yield 'constants all over the class' => [
6970
<<<'PHP'
7071
<?php
71-
class Foo
72+
class C
7273
{
73-
public const BAR = 'bar';
74+
public const FOO = 'foo';
75+
public const F00 = 0;
7476
public function f()
7577
{
76-
return self::BAR . self::BAZ;
78+
return 'Hello ' . self::FOO . self::BAR . '!';
7779
}
78-
public const BAZ = 'baz';
80+
public const BAR = 'bar';
7981
}
8082
PHP,
8183
<<<'PHP'
8284
<?php
83-
class Foo
85+
class C
8486
{
85-
public const BAR = 'bar';
87+
public const FOO = 'foo';
88+
public const F00 = 0;
8689
public function f()
8790
{
88-
return 'bar' . 'baz';
91+
return 'Hello ' . 'foo' . 'bar' . '!';
8992
}
90-
public const BAZ = 'baz';
93+
public const BAR = 'bar';
9194
}
9295
PHP,
9396
];

0 commit comments

Comments
 (0)