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__); }