From 432fa40f57e4eb0072c10a2409a8cc8714dd746b Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 1 Oct 2012 12:15:46 -0500 Subject: [PATCH] Fix potential issue with Sitemap test - Gabriel403 reported that some PHP and PHPUnit combinations made the testDisablingValidators() test fail. Based on the reported failure, it appears that different versions of libxml may result in differences in how empty tags are created (e.g., "" vs ""). Using the assertEqualXMLStructure() assertion should correct this. --- tests/ZendTest/View/Helper/Navigation/SitemapTest.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/ZendTest/View/Helper/Navigation/SitemapTest.php b/tests/ZendTest/View/Helper/Navigation/SitemapTest.php index 1af942135e3..cc6de34b7ae 100644 --- a/tests/ZendTest/View/Helper/Navigation/SitemapTest.php +++ b/tests/ZendTest/View/Helper/Navigation/SitemapTest.php @@ -10,6 +10,7 @@ namespace ZendTest\View\Helper\Navigation; +use DOMDocument; use Zend\View; /** @@ -198,7 +199,13 @@ public function testDisablingValidators() $this->_helper->setUseSitemapValidators(false); $expected = $this->_getExpected('sitemap/invalid.xml'); - $this->assertEquals(trim($expected), $this->_helper->render($nav)); + + // using assertEqualXMLStructure to prevent differences in libxml from invalidating test + $expectedDom = new DOMDocument(); + $receivedDom = new DOMDocument(); + $expectedDom->loadXML($expected); + $receivedDom->loadXML($this->_helper->render($nav)); + $this->assertEqualXMLStructure($expectedDom->documentElement, $receivedDom->documentElement); } public function testSetServerUrlRequiresValidUri()