Merge pull request #19293 from kamil-tekiela/Fix-windows-tests

Use DIRECTORY_SEPARATOR in tests
This commit is contained in:
Maurício Meneghini Fauth 2024-09-23 15:32:16 -03:00 committed by GitHub
commit d78a624dfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,9 @@ use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use function preg_match;
use function str_replace;
use const DIRECTORY_SEPARATOR;
#[CoversClass(Error::class)]
class ErrorTest extends AbstractTestCase
@ -64,7 +67,9 @@ class ErrorTest extends AbstractTestCase
{
$this->object->setFile($file);
$filePath = $this->object->getFile();
self::assertStringStartsWith('./', $filePath);
self::assertStringStartsWith('.' . DIRECTORY_SEPARATOR, $filePath);
/** @psalm-var non-empty-string $expected */
$expected = str_replace('/', DIRECTORY_SEPARATOR, $expected);
self::assertStringEndsWith($expected, $filePath);
}