Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Fix potential issue with Sitemap test
Browse files Browse the repository at this point in the history
- 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., "<lastmod></lastmod>" vs "<lastmod/>"). Using the
  assertEqualXMLStructure() assertion should correct this.
  • Loading branch information
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/Helper/Navigation/SitemapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace ZendTest\View\Helper\Navigation;

use DOMDocument;
use Zend\View;

/**
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 30a31a1

Please sign in to comment.