Skip to content

Commit

Permalink
Merge pull request #278 from rodrigoprimo/test-coverage-byte-order-mask
Browse files Browse the repository at this point in the history
Generic/ByteOrderMark: improve code coverage
  • Loading branch information
jrfnl authored Jan 26, 2024
2 parents 6ba301a + a9642e5 commit 6f8efd4
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.1.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
// File in UTF-8 encoding with byte order mark (BOM) character before the opening PHP tag.
echo 'foo';
?>
3 changes: 3 additions & 0 deletions src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.2.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php // File in UTF-8 encoding without a byte order mark (BOM) character before the opening PHP tag. ?>

<p>Some HTML</p>
Original file line number Diff line number Diff line change
@@ -0,0 +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.
3 changes: 0 additions & 3 deletions src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.inc

This file was deleted.

14 changes: 12 additions & 2 deletions src/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,21 @@ final class ByteOrderMarkUnitTest extends AbstractSniffUnitTest
* The key of the array should represent the line number and the value
* should represent the number of errors that should occur on that line.
*
* @param string $testFile The name of the file being tested.
*
* @return array<int, int>
*/
public function getErrorList()
public function getErrorList($testFile='')
{
return [1 => 1];
switch ($testFile) {
case 'ByteOrderMarkUnitTest.1.inc':
case 'ByteOrderMarkUnitTest.4.inc':
case 'ByteOrderMarkUnitTest.5.inc':
return [1 => 1];

default:
return [];
}

}//end getErrorList()

Expand Down

0 comments on commit 6f8efd4

Please sign in to comment.