Skip to content

Commit

Permalink
infection#654 mutate mb_convert_case with integer mode
Browse files Browse the repository at this point in the history
  • Loading branch information
majkel89 committed Mar 13, 2019
1 parent 21f83cb commit 13af845
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Mutator/Extensions/MBString.php
Expand Up @@ -163,6 +163,8 @@ private function getConvertCaseModeValue(Node\Expr\FuncCall $node): ?int
if (isset(self::MB_CASES[$modeName])) {
return self::MB_CASES[$modeName];
}
} elseif ($mode instanceof Node\Scalar\LNumber) {
return $mode->value;
}

return null;
Expand Down
7 changes: 6 additions & 1 deletion tests/Mutator/Extensions/MBStringTest.php
Expand Up @@ -414,11 +414,16 @@ private function provideMutationCasesForConvertCase(): Generator
"<?php\n\nstrtoupper('test');",
];

yield 'It converts mb_convert_case with MB_CASE_LOWER mode to strtolower' => [
yield 'It converts mb_convert_case with constant similar MB_CASE_LOWER mode to strtolower' => [
"<?php mb_convert_case('test', E_ERROR);",
"<?php\n\nstrtolower('test');",
];

yield 'It converts mb_convert_case with numeric MB_CASE_LOWER (1) mode to strtolower' => [
"<?php mb_convert_case('test', 1);",
"<?php\n\nstrtolower('test');",
];

yield 'It converts mb_convert_case with MB_CASE_LOWER_SIMPLE mode to strtolower' => [
"<?php mb_convert_case('test', MB_CASE_LOWER);",
"<?php\n\nstrtolower('test');",
Expand Down

0 comments on commit 13af845

Please sign in to comment.