minor #14566 [Debug 2.3] Fix test for PHP7 (nicolas-grekas)

This PR was merged into the 2.3 branch.

Discussion
----------

[Debug 2.3] Fix test for PHP7

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

fafcb64 [Debug 2.3] Fix test for PHP7
This commit is contained in:
Nicolas Grekas 2015-05-06 16:11:21 +02:00
commit 6e314dc733
1 changed files with 7 additions and 2 deletions

View File

@ -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());
};