Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic/ByteOrderMark: improve code coverage #278

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading