From fafcb64d00700b31e0d1cd6b481f9eedc8e385c4 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 6 May 2015 12:13:27 +0200 Subject: [PATCH] [Debug 2.3] Fix test for PHP7 --- src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index 7f04d4c3d4..40b726b5e8 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -59,9 +59,14 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase $that = $this; $exceptionCheck = function ($exception) use ($that) { $that->assertInstanceOf('Symfony\Component\Debug\Exception\ContextErrorException', $exception); - $that->assertEquals(E_STRICT, $exception->getSeverity()); $that->assertEquals(2, $exception->getLine()); - $that->assertStringStartsWith('Runtime Notice: Declaration of _CompileTimeError::foo() should be compatible with', $exception->getMessage()); + if (PHP_VERSION_ID < 70000) { + $that->assertEquals(E_STRICT, $exception->getSeverity()); + $that->assertStringStartsWith('Runtime Notice: Declaration of _CompileTimeError::foo() should be compatible with', $exception->getMessage()); + } else { + $that->assertEquals(E_WARNING, $exception->getSeverity()); + $that->assertStringStartsWith('Warning: Declaration of _CompileTimeError::foo() should be compatible with', $exception->getMessage()); + } $that->assertArrayHasKey('bar', $exception->getContext()); };