Skip to content

Commit 995300e

Browse files
committed
PEAR/ClassDeclaration: rename unit test case file to allow for extra files
1 parent b53f64e commit 995300e

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
892892
</dir>
893893
<dir name="Tests">
894894
<dir name="Classes">
895-
<file baseinstalldir="PHP/CodeSniffer" name="ClassDeclarationUnitTest.inc" role="test" />
895+
<file baseinstalldir="PHP/CodeSniffer" name="ClassDeclarationUnitTest.1.inc" role="test" />
896896
<file baseinstalldir="PHP/CodeSniffer" name="ClassDeclarationUnitTest.php" role="test" />
897897
</dir>
898898
<dir name="Commenting">

src/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.php

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,27 @@ class ClassDeclarationUnitTest extends AbstractSniffUnitTest
2121
* The key of the array should represent the line number and the value
2222
* should represent the number of errors that should occur on that line.
2323
*
24+
* @param string $testFile The name of the file being tested.
25+
*
2426
* @return array<int, int>
2527
*/
26-
public function getErrorList()
28+
public function getErrorList($testFile='ClassDeclarationUnitTest.1.inc')
2729
{
28-
return [
29-
21 => 1,
30-
22 => 1,
31-
23 => 1,
32-
27 => 1,
33-
33 => 1,
34-
38 => 1,
35-
49 => 1,
36-
];
30+
switch ($testFile) {
31+
case 'ClassDeclarationUnitTest.1.inc':
32+
return [
33+
21 => 1,
34+
22 => 1,
35+
23 => 1,
36+
27 => 1,
37+
33 => 1,
38+
38 => 1,
39+
49 => 1,
40+
];
41+
42+
default:
43+
return [];
44+
}//end switch
3745

3846
}//end getErrorList()
3947

0 commit comments

Comments
 (0)