[Config] fix error handler restoration in test

This commit is contained in:
Nicolas Grekas 2014-12-22 10:02:19 +01:00
parent ff52a9f928
commit 266afeb161
1 changed files with 11 additions and 4 deletions

View File

@ -160,10 +160,17 @@ class XmlUtilsTest extends \PHPUnit_Framework_TestCase
$file = __DIR__.'/../Fixtures/foo.xml';
try {
XmlUtils::loadFile($file);
$this->fail('An exception should have been raised');
} catch (\InvalidArgumentException $e) {
$this->assertEquals(sprintf('File %s does not contain valid XML, it is empty.', $file), $e->getMessage());
try {
XmlUtils::loadFile($file);
$this->fail('An exception should have been raised');
} catch (\InvalidArgumentException $e) {
$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();