Skip to content

Commit 6964659

Browse files
committed
Rename test case files for ArbitraryParenthesesSpacing sniff
Doing this to be able to add more test case files to cover defensive code in the ArbitraryParenthesesSpacing sniff that protects it when checking code with parse errors.
1 parent aeb53ae commit 6964659

File tree

3 files changed

+57
-41
lines changed

3 files changed

+57
-41
lines changed

src/Standards/Generic/Tests/WhiteSpace/ArbitraryParenthesesSpacingUnitTest.php

Lines changed: 57 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -26,45 +26,53 @@ class ArbitraryParenthesesSpacingUnitTest extends AbstractSniffUnitTest
2626
* The key of the array should represent the line number and the value
2727
* should represent the number of errors that should occur on that line.
2828
*
29+
* @param string $testFile The name of the file being tested.
30+
*
2931
* @return array<int, int>
3032
*/
31-
public function getErrorList()
33+
public function getErrorList($testFile='')
3234
{
33-
return [
34-
64 => 4,
35-
66 => 1,
36-
68 => 1,
37-
69 => 1,
38-
72 => 2,
39-
73 => 2,
40-
77 => 2,
41-
81 => 4,
42-
90 => 4,
43-
94 => 1,
44-
95 => 1,
45-
97 => 1,
46-
100 => 2,
47-
101 => 2,
48-
104 => 2,
49-
107 => 2,
50-
109 => 4,
51-
111 => 4,
52-
113 => 2,
53-
115 => 2,
54-
123 => 1,
55-
125 => 2,
56-
127 => 1,
57-
131 => 1,
58-
133 => 1,
59-
137 => 1,
60-
139 => 2,
61-
141 => 1,
62-
144 => 1,
63-
146 => 1,
64-
163 => 1,
65-
164 => 1,
66-
165 => 1,
67-
];
35+
switch ($testFile) {
36+
case 'ArbitraryParenthesesSpacingUnitTest.1.inc':
37+
return [
38+
64 => 4,
39+
66 => 1,
40+
68 => 1,
41+
69 => 1,
42+
72 => 2,
43+
73 => 2,
44+
77 => 2,
45+
81 => 4,
46+
90 => 4,
47+
94 => 1,
48+
95 => 1,
49+
97 => 1,
50+
100 => 2,
51+
101 => 2,
52+
104 => 2,
53+
107 => 2,
54+
109 => 4,
55+
111 => 4,
56+
113 => 2,
57+
115 => 2,
58+
123 => 1,
59+
125 => 2,
60+
127 => 1,
61+
131 => 1,
62+
133 => 1,
63+
137 => 1,
64+
139 => 2,
65+
141 => 1,
66+
144 => 1,
67+
146 => 1,
68+
163 => 1,
69+
164 => 1,
70+
165 => 1,
71+
];
72+
73+
default:
74+
return [];
75+
}//end switch
6876

6977
}//end getErrorList()
7078

@@ -75,14 +83,22 @@ public function getErrorList()
7583
* The key of the array should represent the line number and the value
7684
* should represent the number of warnings that should occur on that line.
7785
*
86+
* @param string $testFile The name of the file being tested.
87+
*
7888
* @return array<int, int>
7989
*/
80-
public function getWarningList()
90+
public function getWarningList($testFile='')
8191
{
82-
return [
83-
55 => 1,
84-
56 => 1,
85-
];
92+
switch ($testFile) {
93+
case 'ArbitraryParenthesesSpacingUnitTest.1.inc':
94+
return [
95+
55 => 1,
96+
56 => 1,
97+
];
98+
99+
default:
100+
return [];
101+
}//end switch
86102

87103
}//end getWarningList()
88104

0 commit comments

Comments
 (0)