diff --git a/tests/ElasticApmTests/Util/AssertMessageStack.php b/tests/ElasticApmTests/Util/AssertMessageStack.php index 56883efa3..66a1ca56d 100644 --- a/tests/ElasticApmTests/Util/AssertMessageStack.php +++ b/tests/ElasticApmTests/Util/AssertMessageStack.php @@ -39,7 +39,7 @@ final class AssertMessageStack implements LoggableInterface { /** @var bool */ - private static $isEnabled = true; + private static $isEnabled = false; /** @var ?AssertMessageStack */ private static $singleton = null; diff --git a/tests/ElasticApmTests/Util/StackTraceFrameExpectations.php b/tests/ElasticApmTests/Util/StackTraceFrameExpectations.php index 284f3fedf..2f46b5182 100644 --- a/tests/ElasticApmTests/Util/StackTraceFrameExpectations.php +++ b/tests/ElasticApmTests/Util/StackTraceFrameExpectations.php @@ -122,10 +122,11 @@ public static function fromClosure(string $fileName, int $lineNumber, ?string $n if (PHP_VERSION_ID < 80400) { $result = self::fromClassMethodUnknownLocation($class, $isStatic, ($namespace === null ? '' : ($namespace . '\\')) . '{closure}'); } else { - $result = self::fromClassMethodUnknownLocation($class, $isStatic, '{closure:' . $class . '::__METHOD__():__LINE__}'); + $result = self::fromClassMethodUnknownLocation($class, $isStatic, '{closure:__CLASS__::__METHOD__():__LINE__}'); $expectedFunc = $result->function->getValue(); TestCaseBase::assertNotNull($expectedFunc); $expectedFuncRegex = self::convertFunctionNameToRegPattern($expectedFunc); + $expectedFuncRegex = str_replace('__CLASS__', '[a-zA-Z0-9\\\\]+', $expectedFuncRegex); $expectedFuncRegex = str_replace('__METHOD__', '[a-zA-Z0-9]+', $expectedFuncRegex); $expectedFuncRegex = str_replace('__LINE__', '[0-9]+', $expectedFuncRegex); $result->function->setValue($expectedFuncRegex);