bug #13075 [Config] fix error handler restoration in test (nicolas-grekas)
This PR was merged into the 2.3 branch.
Discussion
----------
[Config] fix error handler restoration in test
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
266afeb
[Config] fix error handler restoration in test
This commit is contained in:
commit
cad7f0e99c
@ -159,12 +159,19 @@ class XmlUtilsTest extends \PHPUnit_Framework_TestCase
|
|||||||
});
|
});
|
||||||
|
|
||||||
$file = __DIR__.'/../Fixtures/foo.xml';
|
$file = __DIR__.'/../Fixtures/foo.xml';
|
||||||
|
try {
|
||||||
try {
|
try {
|
||||||
XmlUtils::loadFile($file);
|
XmlUtils::loadFile($file);
|
||||||
$this->fail('An exception should have been raised');
|
$this->fail('An exception should have been raised');
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
$this->assertEquals(sprintf('File %s does not contain valid XML, it is empty.', $file), $e->getMessage());
|
$this->assertEquals(sprintf('File %s does not contain valid XML, it is empty.', $file), $e->getMessage());
|
||||||
}
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
restore_error_handler();
|
||||||
|
error_reporting($errorReporting);
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
error_reporting($errorReporting);
|
error_reporting($errorReporting);
|
||||||
|
Reference in New Issue
Block a user