diff --git a/tests/Monolog/Handler/StreamHandlerTest.php b/tests/Monolog/Handler/StreamHandlerTest.php index 127a36e2..43a520bc 100644 --- a/tests/Monolog/Handler/StreamHandlerTest.php +++ b/tests/Monolog/Handler/StreamHandlerTest.php @@ -145,7 +145,25 @@ class StreamHandlerTest extends TestCase public function testWriteInvalidResource() { $this->expectException(\UnexpectedValueException::class); - $this->expectExceptionMessage('The stream or file "bogus://url" could not be opened in append mode: Failed to open stream: No such file or directory'."\n".'The exception occurred while attempting to log: test'."\n".'Context: {"foo":"bar"}'."\n".'Extra: [1,2,3]'); + $php7xMessage = <<expectExceptionMessage(($majorVersion >= 8) ? $php8xMessage : $php7xMessage); $handler = new StreamHandler('bogus://url'); $record = $this->getRecord();