From 0a023ffb2322d9a2c87d5c1eb209d0c62415be65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Vu=C5=A1ak?= Date: Fri, 18 Mar 2022 09:47:05 +0100 Subject: [PATCH] Calculate exception message according to PHP version (#1644) --- tests/Monolog/Handler/StreamHandlerTest.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/Monolog/Handler/StreamHandlerTest.php b/tests/Monolog/Handler/StreamHandlerTest.php index 127a36e23..43a520bcd 100644 --- a/tests/Monolog/Handler/StreamHandlerTest.php +++ b/tests/Monolog/Handler/StreamHandlerTest.php @@ -145,7 +145,25 @@ public function testWriteInvalidArgument($invalidArgument) 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();