Skip to content

Commit

Permalink
Add tests for windows mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
exussum12 committed Apr 17, 2019
1 parent 9d31de2 commit ad0eb95
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/FileMatchers/EndsWith.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function fileEndsWith($haystack, $needle)

$haystack = str_replace('\\', '/', $haystack);
$needle = str_replace('\\', '/', $needle);

return (substr($haystack, -$length) === $needle);
}
}
22 changes: 22 additions & 0 deletions tests/FileMatchers/EndsWithTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
namespace exussum12\CoverageChecker\tests\FileMatchers;

use PHPUnit\Framework\TestCase;
use exussum12\CoverageChecker\FileMatchers\EndsWith;

class EndsWithTest extends TestCase
{
public function testPrefix()
{
$prefixMatcher = new EndsWith();
$needle = 'windows\\file.php';
$haystack = [
'/full/path/to/windows/file.php',
];

$this->assertEquals(
'/full/path/to/windows/file.php',
$prefixMatcher->match($needle, $haystack)
);
}
}

0 comments on commit ad0eb95

Please sign in to comment.