createMock(Request::class); $exception = new ErrorException('Lorem Ipsum', 4242, 1, 'foo.php', 9999); $regex = sprintf( '%%.*ErrorException.*4242.*Lorem Ipsum.*%s.*%s.*%s.*%%is', 'foo.php', 9999, __FUNCTION__ ); $this->expectOutputRegex($regex); $handler->render($request, $exception); } }