From 3dc9c4eac1473cf43548644c484eed69ad3f61c0 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 24 Mar 2024 22:18:03 +0100 Subject: [PATCH] fix tests on Windows --- src/Symfony/Component/Filesystem/Tests/FilesystemTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index a1b3a666138c..8bba20e4a2be 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -1812,7 +1812,7 @@ public function testReadFile() public function testReadNonExistentFile() { $this->expectException(IOException::class); - $this->expectExceptionMessageMatches('#^Failed to read file ".+/Tests/invalid"\\: file_get_contents\\(.+/Tests/invalid\\)\\: Failed to open stream\\: No such file or directory$#'); + $this->expectExceptionMessageMatches(sprintf('#^Failed to read file ".+%1$sTests/invalid"\\: file_get_contents\\(.+%1$sTests/invalid\\)\\: Failed to open stream\\: No such file or directory$#', preg_quote(\DIRECTORY_SEPARATOR))); $this->filesystem->readFile(__DIR__.'/invalid'); } @@ -1820,7 +1820,7 @@ public function testReadNonExistentFile() public function testReadDirectory() { $this->expectException(IOException::class); - $this->expectExceptionMessageMatches('#^Failed to read file ".+/Tests"\\: File is a directory\\.$#'); + $this->expectExceptionMessageMatches(sprintf('#^Failed to read file ".+%sTests"\\: File is a directory\\.$#', preg_quote(\DIRECTORY_SEPARATOR))); $this->filesystem->readFile(__DIR__); }