Skip to content

Commit 8a464d9

Browse files
committed
Tests: rename various test case files
... to allow for adding additional test case files containing parse errors.
1 parent d91b9f2 commit 8a464d9

14 files changed

+305
-227
lines changed

src/Standards/Generic/Tests/PHP/LowerCaseTypeUnitTest.php

Lines changed: 84 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -26,74 +26,82 @@ final class LowerCaseTypeUnitTest 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-
14 => 1,
35-
15 => 1,
36-
16 => 1,
37-
17 => 1,
38-
18 => 1,
39-
21 => 4,
40-
22 => 3,
41-
23 => 3,
42-
25 => 1,
43-
26 => 2,
44-
27 => 2,
45-
32 => 4,
46-
36 => 1,
47-
37 => 1,
48-
38 => 1,
49-
39 => 1,
50-
43 => 2,
51-
44 => 1,
52-
46 => 1,
53-
49 => 1,
54-
51 => 2,
55-
53 => 1,
56-
55 => 2,
57-
60 => 1,
58-
61 => 1,
59-
62 => 1,
60-
63 => 1,
61-
64 => 1,
62-
65 => 1,
63-
66 => 1,
64-
67 => 1,
65-
68 => 1,
66-
69 => 1,
67-
71 => 3,
68-
72 => 2,
69-
73 => 3,
70-
74 => 3,
71-
78 => 3,
72-
82 => 2,
73-
85 => 1,
74-
94 => 5,
75-
96 => 4,
76-
105 => 1,
77-
106 => 1,
78-
107 => 1,
79-
111 => 1,
80-
112 => 1,
81-
113 => 1,
82-
114 => 1,
83-
117 => 1,
84-
118 => 1,
85-
119 => 1,
86-
122 => 3,
87-
123 => 2,
88-
124 => 3,
89-
125 => 3,
90-
129 => 2,
91-
131 => 1,
92-
134 => 1,
93-
135 => 1,
94-
136 => 1,
95-
139 => 2,
96-
];
35+
switch ($testFile) {
36+
case 'LowerCaseTypeUnitTest.1.inc':
37+
return [
38+
14 => 1,
39+
15 => 1,
40+
16 => 1,
41+
17 => 1,
42+
18 => 1,
43+
21 => 4,
44+
22 => 3,
45+
23 => 3,
46+
25 => 1,
47+
26 => 2,
48+
27 => 2,
49+
32 => 4,
50+
36 => 1,
51+
37 => 1,
52+
38 => 1,
53+
39 => 1,
54+
43 => 2,
55+
44 => 1,
56+
46 => 1,
57+
49 => 1,
58+
51 => 2,
59+
53 => 1,
60+
55 => 2,
61+
60 => 1,
62+
61 => 1,
63+
62 => 1,
64+
63 => 1,
65+
64 => 1,
66+
65 => 1,
67+
66 => 1,
68+
67 => 1,
69+
68 => 1,
70+
69 => 1,
71+
71 => 3,
72+
72 => 2,
73+
73 => 3,
74+
74 => 3,
75+
78 => 3,
76+
82 => 2,
77+
85 => 1,
78+
94 => 5,
79+
96 => 4,
80+
105 => 1,
81+
106 => 1,
82+
107 => 1,
83+
111 => 1,
84+
112 => 1,
85+
113 => 1,
86+
114 => 1,
87+
117 => 1,
88+
118 => 1,
89+
119 => 1,
90+
122 => 3,
91+
123 => 2,
92+
124 => 3,
93+
125 => 3,
94+
129 => 2,
95+
131 => 1,
96+
134 => 1,
97+
135 => 1,
98+
136 => 1,
99+
139 => 2,
100+
];
101+
102+
default:
103+
return [];
104+
}//end switch
97105

98106
}//end getErrorList()
99107

@@ -104,12 +112,20 @@ public function getErrorList()
104112
* The key of the array should represent the line number and the value
105113
* should represent the number of warnings that should occur on that line.
106114
*
115+
* @param string $testFile The name of the file being tested.
116+
*
107117
* @return array<int, int>
108118
*/
109-
public function getWarningList()
119+
public function getWarningList($testFile='')
110120
{
111-
// Warning from getMemberProperties() about parse error.
112-
return [144 => 1];
121+
switch ($testFile) {
122+
case 'LowerCaseTypeUnitTest.1.inc':
123+
// Warning from getMemberProperties() about parse error.
124+
return [144 => 1];
125+
126+
default:
127+
return [];
128+
}//end switch
113129

114130
}//end getWarningList()
115131

src/Standards/PEAR/Tests/NamingConventions/ValidVariableNameUnitTest.php

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,27 @@ final class ValidVariableNameUnitTest 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-
12 => 1,
35-
17 => 1,
36-
22 => 1,
37-
92 => 1,
38-
93 => 1,
39-
94 => 1,
40-
99 => 1,
41-
];
35+
switch ($testFile) {
36+
case 'ValidVariableNameUnitTest.1.inc':
37+
return [
38+
12 => 1,
39+
17 => 1,
40+
22 => 1,
41+
92 => 1,
42+
93 => 1,
43+
94 => 1,
44+
99 => 1,
45+
];
46+
47+
default:
48+
return [];
49+
}//end switch
4250

4351
}//end getErrorList()
4452

src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.php

Lines changed: 56 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,50 @@ final class PropertyDeclarationUnitTest 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-
7 => 1,
35-
9 => 2,
36-
10 => 1,
37-
11 => 1,
38-
17 => 1,
39-
18 => 1,
40-
23 => 1,
41-
38 => 1,
42-
41 => 1,
43-
42 => 1,
44-
50 => 2,
45-
51 => 1,
46-
55 => 1,
47-
56 => 1,
48-
61 => 1,
49-
62 => 1,
50-
68 => 1,
51-
69 => 1,
52-
71 => 1,
53-
72 => 1,
54-
76 => 1,
55-
80 => 1,
56-
82 => 1,
57-
84 => 1,
58-
86 => 1,
59-
90 => 1,
60-
94 => 1,
61-
95 => 1,
62-
96 => 1,
63-
97 => 2,
64-
];
35+
switch ($testFile) {
36+
case 'PropertyDeclarationUnitTest.1.inc':
37+
return [
38+
7 => 1,
39+
9 => 2,
40+
10 => 1,
41+
11 => 1,
42+
17 => 1,
43+
18 => 1,
44+
23 => 1,
45+
38 => 1,
46+
41 => 1,
47+
42 => 1,
48+
50 => 2,
49+
51 => 1,
50+
55 => 1,
51+
56 => 1,
52+
61 => 1,
53+
62 => 1,
54+
68 => 1,
55+
69 => 1,
56+
71 => 1,
57+
72 => 1,
58+
76 => 1,
59+
80 => 1,
60+
82 => 1,
61+
84 => 1,
62+
86 => 1,
63+
90 => 1,
64+
94 => 1,
65+
95 => 1,
66+
96 => 1,
67+
97 => 2,
68+
];
69+
70+
default:
71+
return [];
72+
}//end switch
6573

6674
}//end getErrorList()
6775

@@ -72,16 +80,24 @@ public function getErrorList()
7280
* The key of the array should represent the line number and the value
7381
* should represent the number of warnings that should occur on that line.
7482
*
83+
* @param string $testFile The name of the file being tested.
84+
*
7585
* @return array<int, int>
7686
*/
77-
public function getWarningList()
87+
public function getWarningList($testFile='')
7888
{
79-
return [
80-
13 => 1,
81-
14 => 1,
82-
15 => 1,
83-
53 => 1,
84-
];
89+
switch ($testFile) {
90+
case 'PropertyDeclarationUnitTest.1.inc':
91+
return [
92+
13 => 1,
93+
14 => 1,
94+
15 => 1,
95+
53 => 1,
96+
];
97+
98+
default:
99+
return [];
100+
}//end switch
85101

86102
}//end getWarningList()
87103

0 commit comments

Comments
 (0)