From 29d696944cf4877f1c417d6e3ebe4495d22ab9c2 Mon Sep 17 00:00:00 2001 From: Possum Date: Thu, 29 Oct 2015 11:26:44 +0100 Subject: [PATCH] Set back libxml settings after testings. --- src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php | 7 +++++-- .../Translation/Tests/Loader/XliffFileLoaderTest.php | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php index f592e571c2..cff40b1232 100644 --- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php +++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php @@ -63,11 +63,14 @@ class XmlUtilsTest extends \PHPUnit_Framework_TestCase public function testLoadFileWithInternalErrorsEnabled() { - libxml_use_internal_errors(true); + $internalErrors = libxml_use_internal_errors(true); $this->assertSame(array(), libxml_get_errors()); $this->assertInstanceOf('DOMDocument', XmlUtils::loadFile(__DIR__.'/../Fixtures/Util/invalid_schema.xml')); $this->assertSame(array(), libxml_get_errors()); + + libxml_clear_errors(); + libxml_use_internal_errors($internalErrors); } /** @@ -144,7 +147,7 @@ class XmlUtilsTest extends \PHPUnit_Framework_TestCase public function testLoadEmptyXmlFile() { $file = __DIR__.'/../Fixtures/foo.xml'; - $this->setExpectedException('InvalidArgumentException', 'File '.$file.' does not contain valid XML, it is empty.'); + $this->setExpectedException('InvalidArgumentException', sprintf('File %s does not contain valid XML, it is empty.', $file)); XmlUtils::loadFile($file); } diff --git a/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php index ff986d2f33..a3aa89597a 100644 --- a/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php +++ b/src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php @@ -30,7 +30,7 @@ class XliffFileLoaderTest extends \PHPUnit_Framework_TestCase public function testLoadWithInternalErrorsEnabled() { - libxml_use_internal_errors(true); + $internalErrors = libxml_use_internal_errors(true); $this->assertSame(array(), libxml_get_errors()); @@ -41,6 +41,9 @@ class XliffFileLoaderTest extends \PHPUnit_Framework_TestCase $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); $this->assertSame(array(), libxml_get_errors()); + + libxml_clear_errors(); + libxml_use_internal_errors($internalErrors); } public function testLoadWithResname()