From 266afeb1611c83e5a25156bd8c0081ea991d8a8e Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 22 Dec 2014 10:02:19 +0100 Subject: [PATCH] [Config] fix error handler restoration in test --- .../Component/Config/Tests/Util/XmlUtilsTest.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php index 900e6b0f75..f592e571c2 100644 --- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php +++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php @@ -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();