[Debug 2.3] Fix test for PHP7

This commit is contained in:
Nicolas Grekas 2015-05-06 12:13:27 +02:00
parent b77d8c5bc5
commit fafcb64d00

View File

@ -59,9 +59,14 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
$that = $this; $that = $this;
$exceptionCheck = function ($exception) use ($that) { $exceptionCheck = function ($exception) use ($that) {
$that->assertInstanceOf('Symfony\Component\Debug\Exception\ContextErrorException', $exception); $that->assertInstanceOf('Symfony\Component\Debug\Exception\ContextErrorException', $exception);
$that->assertEquals(E_STRICT, $exception->getSeverity());
$that->assertEquals(2, $exception->getLine()); $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()); $that->assertArrayHasKey('bar', $exception->getContext());
}; };