Skip to content

Commit 6f8efd4

Browse files
authored
Merge pull request #278 from rodrigoprimo/test-coverage-byte-order-mask
Generic/ByteOrderMark: improve code coverage
2 parents 6ba301a + a9642e5 commit 6f8efd4

7 files changed

+20
-5
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
// File in UTF-8 encoding with byte order mark (BOM) character before the opening PHP tag.
3+
echo 'foo';
4+
?>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php // File in UTF-8 encoding without a byte order mark (BOM) character before the opening PHP tag. ?>
2+
3+
<p>Some HTML</p>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>Some HTML at the beginning of an ANSI/iso-8859-1 encoded file without a byte order mark (BOM) character</p>
Binary file not shown.
Binary file not shown.

src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.inc

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,21 @@ final class ByteOrderMarkUnitTest 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 [1 => 1];
35+
switch ($testFile) {
36+
case 'ByteOrderMarkUnitTest.1.inc':
37+
case 'ByteOrderMarkUnitTest.4.inc':
38+
case 'ByteOrderMarkUnitTest.5.inc':
39+
return [1 => 1];
40+
41+
default:
42+
return [];
43+
}
3444

3545
}//end getErrorList()
3646

0 commit comments

Comments
 (0)