Skip to content

Commit 339f0e4

Browse files
committed
PhpUnitConstructFixer - Fix handle different casing
1 parent ae4b178 commit 339f0e4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Fixer/PhpUnit/PhpUnitConstructFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ private function fixAssert(array $map, Tokens $tokens, $index, $method)
215215
return $sequenceIndexes[3];
216216
}
217217

218-
$tokens[$sequenceIndexes[0]] = new Token([T_STRING, $map[$firstParameterToken->getContent()]]);
218+
$tokens[$sequenceIndexes[0]] = new Token([T_STRING, $map[strtolower($firstParameterToken->getContent())]]);
219219
$tokens->clearRange($sequenceIndexes[2], $tokens->getNextNonWhitespace($sequenceIndexes[3]) - 1);
220220

221221
return $sequenceIndexes[3];

tests/Fixer/PhpUnit/PhpUnitConstructFixerTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ public function provideTestFixCases()
125125
'<?php $this->assertSame(true || $a, $b); $this->assertTrue($c);',
126126
'<?php $this->assertSame(true || $a, $b); $this->assertSame(true, $c);',
127127
],
128+
[
129+
'<?php $this->assertFalse($foo);',
130+
'<?php $this->assertEquals(FALSE, $foo);',
131+
],
132+
[
133+
'<?php $this->assertTrue($foo);',
134+
'<?php $this->assertEquals(TruE, $foo);',
135+
],
136+
[
137+
'<?php $this->assertNull($foo);',
138+
'<?php $this->assertEquals(NULL, $foo);',
139+
],
128140
];
129141

130142
return array_merge(

0 commit comments

Comments
 (0)