Skip to content

Commit

Permalink
infection#654 add tests cases for capitalization
Browse files Browse the repository at this point in the history
  • Loading branch information
majkel89 committed Mar 30, 2019
1 parent 3b486ca commit a6a4e4b
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions tests/Mutator/Extensions/MBStringTest.php
Expand Up @@ -126,6 +126,11 @@ private function provideMutationCasesForChr(): Generator
"<?php\n\nchr(74);",
];

yield 'It converts correctly when mb_chr is wrongly capitalized' => [
'<?php mB_cHr(74);',
"<?php\n\nchr(74);",
];

yield 'It converts mb_chr with encoding to chr' => [
"<?php mb_chr(74, 'utf-8');",
"<?php\n\nchr(74);",
Expand All @@ -139,6 +144,11 @@ private function provideMutationCasesForOrd(): Generator
"<?php\n\nord('T');",
];

yield 'It converts correctly when mb_ord is wrongly capitalized' => [
"<?php MB_ord('T');",
"<?php\n\nord('T');",
];

yield 'It converts mb_ord with encoding to ord' => [
"<?php mb_ord('T', 'utf-8');",
"<?php\n\nord('T');",
Expand All @@ -152,6 +162,11 @@ private function provideMutationCasesForParseStr(): Generator
"<?php\n\nparse_str('T');",
];

yield 'It converts correctly when mb_parse_str is wrongly capitalize' => [
"<?php mb_pARse_Str('T');",
"<?php\n\nparse_str('T');",
];

yield 'It converts mb_parse_str with params argument to parse_str' => [
"<?php mb_parse_str('T', \$params);",
"<?php\n\nparse_str('T', \$params);",
Expand All @@ -165,6 +180,11 @@ private function provideMutationCasesForSendMail(): Generator
"<?php\n\nmail('to', 'subject', 'msg');",
];

yield 'It converts correctly when mb_send_mail is wrongly capitalize' => [
"<?php mb_SEND_mail('to', 'subject', 'msg');",
"<?php\n\nmail('to', 'subject', 'msg');",
];

yield 'It converts mb_send_mail with additional parameters to mail' => [
"<?php mb_send_mail('to', 'subject', 'msg', [], []);",
"<?php\n\nmail('to', 'subject', 'msg', [], []);",
Expand All @@ -178,6 +198,11 @@ private function provideMutationCasesForStrCut(): Generator
"<?php\n\nsubstr('subject', 1);",
];

yield 'It converts correctly when mb_strcut is wrongly capitalize' => [
"<?php MB_strcut('subject', 1);",
"<?php\n\nsubstr('subject', 1);",
];

yield 'It converts mb_strcut with limit to substr' => [
"<?php mb_strcut('subject', 1, 20);",
"<?php\n\nsubstr('subject', 1, 20);",
Expand All @@ -196,6 +221,11 @@ private function provideMutationCasesForStrPos(): Generator
"<?php\n\nstrpos('subject', 'b');",
];

yield 'It converts correctly when mb_strpos is wrongly capitalize' => [
"<?php mb_StRpOs('subject', 'b');",
"<?php\n\nstrpos('subject', 'b');",
];

yield 'It converts mb_strpos with offset to strpos' => [
"<?php mb_strpos('subject', 'b', 3);",
"<?php\n\nstrpos('subject', 'b', 3);",
Expand All @@ -214,6 +244,11 @@ private function provideMutationCasesForStrIPos(): Generator
"<?php\n\nstripos('subject', 'b');",
];

yield 'It converts correctly when mb_stripos is wrongly capitalize' => [
"<?php mB_sTRIpos('subject', 'b');",
"<?php\n\nstripos('subject', 'b');",
];

yield 'It converts mb_stripos with offset to stripos' => [
"<?php mb_stripos('subject', 'b', 3);",
"<?php\n\nstripos('subject', 'b', 3);",
Expand All @@ -232,6 +267,11 @@ private function provideMutationCasesForStrIStr(): Generator
"<?php\n\nstristr('subject', 'b');",
];

yield 'It converts correctly when mb_stristr is wrongly capitalize' => [
"<?php mb_strISTR('subject', 'b');",
"<?php\n\nstristr('subject', 'b');",
];

yield 'It converts mb_stristr with part argument to stristr' => [
"<?php mb_stristr('subject', 'b', false);",
"<?php\n\nstristr('subject', 'b', false);",
Expand All @@ -250,6 +290,11 @@ private function provideMutationCasesForStrRiPos(): Generator
"<?php\n\nstrripos('subject', 'b');",
];

yield 'It converts correctly when mb_strripos is wrongly capitalize' => [
"<?php MB_sTrRipos('subject', 'b');",
"<?php\n\nstrripos('subject', 'b');",
];

yield 'It converts mb_strripos with offset argument to strripos' => [
"<?php mb_strripos('subject', 'b', 2);",
"<?php\n\nstrripos('subject', 'b', 2);",
Expand All @@ -268,6 +313,11 @@ private function provideMutationCasesForStrRPos(): Generator
"<?php\n\nstrrpos('subject', 'b');",
];

yield 'It converts correctly when mb_strrpos is wrongly capitalize' => [
"<?php mb_StRrPos('subject', 'b');",
"<?php\n\nstrrpos('subject', 'b');",
];

yield 'It converts mb_strrpos with offset argument to strrpos' => [
"<?php mb_strrpos('subject', 'b', 2);",
"<?php\n\nstrrpos('subject', 'b', 2);",
Expand All @@ -286,6 +336,11 @@ private function provideMutationCasesForStrStr(): Generator
"<?php\n\nstrstr('subject', 'b');",
];

yield 'It converts correctly when mb_strstr is wrongly capitalize' => [
"<?php Mb_STRstr('subject', 'b');",
"<?php\n\nstrstr('subject', 'b');",
];

yield 'It converts mb_strstr with part argument to strstr' => [
"<?php mb_strstr('subject', 'b', false);",
"<?php\n\nstrstr('subject', 'b', false);",
Expand All @@ -304,6 +359,11 @@ private function provideMutationCasesForStrToLower(): Generator
"<?php\n\nstrtolower('test');",
];

yield 'It converts correctly when mb_strtolower is wrongly capitalize' => [
"<?php mB_StrTOloWer('test');",
"<?php\n\nstrtolower('test');",
];

yield 'It converts mb_strtolower with encoding to strtolower' => [
"<?php mb_strtolower('test', 'utf-8');",
"<?php\n\nstrtolower('test');",
Expand All @@ -317,6 +377,11 @@ private function provideMutationCasesForStrToUpper(): Generator
"<?php\n\nstrtoupper('test');",
];

yield 'It converts correctly when mb_strtoupper is wrongly capitalize' => [
"<?php Mb_StrToupPer('test');",
"<?php\n\nstrtoupper('test');",
];

yield 'It converts mb_strtoupper with encoding to strtoupper' => [
"<?php mb_strtoupper('test', 'utf-8');",
"<?php\n\nstrtoupper('test');",
Expand All @@ -330,6 +395,11 @@ private function provideMutationCasesForSubStrCount(): Generator
"<?php\n\nsubstr_count('test', 't');",
];

yield 'It converts correctly when mb_substr_count is wrongly capitalize' => [
"<?php MB_substr_COunt('test', 't');",
"<?php\n\nsubstr_count('test', 't');",
];

yield 'It converts mb_substr_count with encoding to substr_count' => [
"<?php mb_substr_count('test', 't', 'utf-8');",
"<?php\n\nsubstr_count('test', 't');",
Expand All @@ -343,6 +413,11 @@ private function provideMutationCasesForSubStr(): Generator
"<?php\n\nsubstr('test', 2);",
];

yield 'It converts correctly when mb_substr is wrongly capitalize' => [
"<?php mB_SuBsTr('test', 2);",
"<?php\n\nsubstr('test', 2);",
];

yield 'It converts mb_substr with length argument to substr' => [
"<?php mb_substr('test', 2, 10);",
"<?php\n\nsubstr('test', 2, 10);",
Expand All @@ -361,6 +436,11 @@ private function provideMutationCasesForStrRChr(): Generator
"<?php\n\nstrrchr('subject', 'b');",
];

yield 'It converts correctly when mb_strrchr is wrongly capitalize' => [
"<?php MB_StRrcHr('subject', 'b');",
"<?php\n\nstrrchr('subject', 'b');",
];

yield 'It converts mb_strrchr with part argument to strrchr' => [
"<?php mb_strrchr('subject', 'b', false);",
"<?php\n\nstrrchr('subject', 'b');",
Expand All @@ -379,6 +459,11 @@ private function provideMutationCasesForConvertCase(): Generator
"<?php\n\nstrtoupper('test');",
];

yield 'It converts correctly when mb_parse_str is wrongly capitalize' => [
"<?php Mb_CoNvErT_Case('test', MB_CASE_UPPER);",
"<?php\n\nstrtoupper('test');",
];

yield 'It converts mb_convert_case with MB_CASE_UPPER_SIMPLE mode to strtoupper' => [
"<?php mb_convert_case('test', MB_CASE_UPPER_SIMPLE);",
"<?php\n\nstrtoupper('test');",
Expand Down

0 comments on commit a6a4e4b

Please sign in to comment.