@@ -24,85 +24,101 @@ final class DeprecatedFunctionsUnitTest extends AbstractSniffUnitTest {
2424 /**
2525 * Returns the lines where errors should occur.
2626 *
27+ * @param string $testFile The test file to check for errors.
28+ *
2729 * @return array<int, int> Key is the line number, value is the number of expected errors.
2830 */
29- public function getErrorList () {
30- $ start_line = 8 ;
31- $ end_line = 420 ;
32- $ errors = array_fill ( $ start_line , ( ( $ end_line - $ start_line ) + 1 ), 1 );
31+ public function getErrorList ( $ testFile = '' ) {
32+ switch ( $ testFile ) {
33+ case 'DeprecatedFunctionsUnitTest.1.inc ' :
34+ $ start_line = 8 ;
35+ $ end_line = 420 ;
36+ $ errors = array_fill ( $ start_line , ( ( $ end_line - $ start_line ) + 1 ), 1 );
37+
38+ // Unset the lines related to version comments.
39+ unset(
40+ $ errors [10 ],
41+ $ errors [12 ],
42+ $ errors [14 ],
43+ $ errors [16 ],
44+ $ errors [29 ],
45+ $ errors [55 ],
46+ $ errors [57 ],
47+ $ errors [59 ],
48+ $ errors [73 ],
49+ $ errors [76 ],
50+ $ errors [80 ],
51+ $ errors [102 ], // Undeprecated function.
52+ $ errors [118 ],
53+ $ errors [125 ],
54+ $ errors [162 ],
55+ $ errors [175 ],
56+ $ errors [179 ],
57+ $ errors [211 ],
58+ $ errors [234 ],
59+ $ errors [252 ],
60+ $ errors [256 ],
61+ $ errors [263 ],
62+ $ errors [275 ],
63+ $ errors [282 ],
64+ $ errors [286 ],
65+ $ errors [291 ],
66+ $ errors [296 ],
67+ $ errors [304 ],
68+ $ errors [311 ],
69+ $ errors [319 ],
70+ $ errors [323 ],
71+ $ errors [330 ],
72+ $ errors [332 ],
73+ $ errors [337 ],
74+ $ errors [340 ],
75+ $ errors [344 ],
76+ $ errors [346 ],
77+ $ errors [353 ],
78+ $ errors [357 ],
79+ $ errors [359 ],
80+ $ errors [361 ],
81+ $ errors [363 ],
82+ $ errors [369 ],
83+ $ errors [371 ],
84+ $ errors [373 ],
85+ $ errors [383 ],
86+ $ errors [386 ],
87+ $ errors [410 ]
88+ );
3389
34- // Unset the lines related to version comments.
35- unset(
36- $ errors [10 ],
37- $ errors [12 ],
38- $ errors [14 ],
39- $ errors [16 ],
40- $ errors [29 ],
41- $ errors [55 ],
42- $ errors [57 ],
43- $ errors [59 ],
44- $ errors [73 ],
45- $ errors [76 ],
46- $ errors [80 ],
47- $ errors [102 ], // Undeprecated function.
48- $ errors [118 ],
49- $ errors [125 ],
50- $ errors [162 ],
51- $ errors [175 ],
52- $ errors [179 ],
53- $ errors [211 ],
54- $ errors [234 ],
55- $ errors [252 ],
56- $ errors [256 ],
57- $ errors [263 ],
58- $ errors [275 ],
59- $ errors [282 ],
60- $ errors [286 ],
61- $ errors [291 ],
62- $ errors [296 ],
63- $ errors [304 ],
64- $ errors [311 ],
65- $ errors [319 ],
66- $ errors [323 ],
67- $ errors [330 ],
68- $ errors [332 ],
69- $ errors [337 ],
70- $ errors [340 ],
71- $ errors [344 ],
72- $ errors [346 ],
73- $ errors [353 ],
74- $ errors [357 ],
75- $ errors [359 ],
76- $ errors [361 ],
77- $ errors [363 ],
78- $ errors [369 ],
79- $ errors [371 ],
80- $ errors [373 ],
81- $ errors [383 ],
82- $ errors [386 ],
83- $ errors [410 ]
84- );
90+ return $ errors ;
8591
86- return $ errors ;
92+ default :
93+ return array ();
94+ }
8795 }
8896
8997 /**
9098 * Returns the lines where warnings should occur.
9199 *
100+ * @param string $testFile The test file to check for warnings.
101+ *
92102 * @return array<int, int> Key is the line number, value is the number of expected warnings.
93103 */
94- public function getWarningList () {
95- $ start_line = 426 ;
96- $ end_line = 443 ;
97- $ warnings = array_fill ( $ start_line , ( ( $ end_line - $ start_line ) + 1 ), 1 );
104+ public function getWarningList ( $ testFile = '' ) {
105+ switch ( $ testFile ) {
106+ case 'DeprecatedFunctionsUnitTest.1.inc ' :
107+ $ start_line = 426 ;
108+ $ end_line = 443 ;
109+ $ warnings = array_fill ( $ start_line , ( ( $ end_line - $ start_line ) + 1 ), 1 );
110+
111+ // Unset the lines related to version comments.
112+ unset(
113+ $ warnings [429 ],
114+ $ warnings [432 ],
115+ $ warnings [442 ]
116+ );
98117
99- // Unset the lines related to version comments.
100- unset(
101- $ warnings [429 ],
102- $ warnings [432 ],
103- $ warnings [442 ]
104- );
118+ return $ warnings ;
105119
106- return $ warnings ;
120+ default :
121+ return array ();
122+ }
107123 }
108124}
0 commit comments