Skip to content

Commit 0076d49

Browse files
committed
NamingConventions/ValidFunctionName: rename test case file
This is necessary to be able to create more test case files with syntax errors in a future commit.
1 parent 00e9af7 commit 0076d49

File tree

2 files changed

+38
-30
lines changed

2 files changed

+38
-30
lines changed

WordPress/Tests/NamingConventions/ValidFunctionNameUnitTest.inc renamed to WordPress/Tests/NamingConventions/ValidFunctionNameUnitTest.1.inc

File renamed without changes.

WordPress/Tests/NamingConventions/ValidFunctionNameUnitTest.php

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,38 +25,46 @@ final class ValidFunctionNameUnitTest extends AbstractSniffUnitTest {
2525
/**
2626
* Returns the lines where errors should occur.
2727
*
28+
* @param string $testFile The name of the file being tested.
29+
*
2830
* @return array<int, int> Key is the line number, value is the number of expected errors.
2931
*/
30-
public function getErrorList() {
31-
return array(
32-
3 => 1,
33-
9 => 1,
34-
13 => 1,
35-
15 => 1,
36-
79 => 2,
37-
80 => 2,
38-
81 => 2,
39-
82 => 2,
40-
83 => 2,
41-
84 => 2,
42-
85 => 2,
43-
86 => 2,
44-
87 => 2,
45-
88 => 2,
46-
89 => 2,
47-
106 => 2,
48-
116 => 1,
49-
117 => 1,
50-
157 => 2,
51-
183 => 1,
52-
184 => 1,
53-
185 => 1,
54-
199 => 1,
55-
208 => 2,
56-
210 => 1,
57-
223 => function_exists( 'mb_strtolower' ) ? 1 : 0,
58-
224 => 1,
59-
);
32+
public function getErrorList( $testFile = '' ) {
33+
switch ( $testFile ) {
34+
case 'ValidFunctionNameUnitTest.1.inc':
35+
return array(
36+
3 => 1,
37+
9 => 1,
38+
13 => 1,
39+
15 => 1,
40+
79 => 2,
41+
80 => 2,
42+
81 => 2,
43+
82 => 2,
44+
83 => 2,
45+
84 => 2,
46+
85 => 2,
47+
86 => 2,
48+
87 => 2,
49+
88 => 2,
50+
89 => 2,
51+
106 => 2,
52+
116 => 1,
53+
117 => 1,
54+
157 => 2,
55+
183 => 1,
56+
184 => 1,
57+
185 => 1,
58+
199 => 1,
59+
208 => 2,
60+
210 => 1,
61+
223 => function_exists( 'mb_strtolower' ) ? 1 : 0,
62+
224 => 1,
63+
);
64+
65+
default:
66+
return array();
67+
}
6068
}
6169

6270
/**

0 commit comments

Comments
 (0)