Skip to content

Commit 9b7e075

Browse files
rodrigoprimojrfnl
authored andcommitted
Rename test case file for AssignmentInCondition sniff
Doing this to be able to add more test case files to cover defensive code in the AssignmentInCondition sniff that protects it when checking code with parse errors.
1 parent 30f768d commit 9b7e075

File tree

2 files changed

+45
-37
lines changed

2 files changed

+45
-37
lines changed

src/Standards/Generic/Tests/CodeAnalysis/AssignmentInConditionUnitTest.php

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -41,46 +41,54 @@ public function getErrorList()
4141
* The key of the array should represent the line number and the value
4242
* should represent the number of warnings that should occur on that line.
4343
*
44+
* @param string $testFile The name of the file being tested.
45+
*
4446
* @return array<int, int>
4547
*/
46-
public function getWarningList()
48+
public function getWarningList($testFile='')
4749
{
48-
return [
49-
46 => 1,
50-
47 => 1,
51-
48 => 1,
52-
49 => 1,
53-
50 => 1,
54-
51 => 1,
55-
52 => 1,
56-
53 => 1,
57-
54 => 1,
58-
55 => 1,
59-
56 => 1,
60-
57 => 1,
61-
58 => 1,
62-
59 => 1,
63-
60 => 1,
64-
61 => 2,
65-
63 => 1,
66-
64 => 1,
67-
67 => 1,
68-
68 => 1,
69-
69 => 1,
70-
70 => 1,
71-
71 => 1,
72-
72 => 1,
73-
73 => 1,
74-
75 => 1,
75-
77 => 1,
76-
80 => 2,
77-
84 => 1,
78-
85 => 2,
79-
88 => 1,
80-
90 => 1,
81-
92 => 1,
82-
95 => 1,
83-
];
50+
switch ($testFile) {
51+
case 'AssignmentInConditionUnitTest.1.inc':
52+
return [
53+
46 => 1,
54+
47 => 1,
55+
48 => 1,
56+
49 => 1,
57+
50 => 1,
58+
51 => 1,
59+
52 => 1,
60+
53 => 1,
61+
54 => 1,
62+
55 => 1,
63+
56 => 1,
64+
57 => 1,
65+
58 => 1,
66+
59 => 1,
67+
60 => 1,
68+
61 => 2,
69+
63 => 1,
70+
64 => 1,
71+
67 => 1,
72+
68 => 1,
73+
69 => 1,
74+
70 => 1,
75+
71 => 1,
76+
72 => 1,
77+
73 => 1,
78+
75 => 1,
79+
77 => 1,
80+
80 => 2,
81+
84 => 1,
82+
85 => 2,
83+
88 => 1,
84+
90 => 1,
85+
92 => 1,
86+
95 => 1,
87+
];
88+
89+
default:
90+
return [];
91+
}//end switch
8492

8593
}//end getWarningList()
8694

0 commit comments

Comments
 (0)