Fix unit tests

This commit is contained in:
troosan 2019-01-02 09:28:51 +01:00 committed by GitHub
parent b54200e5d8
commit 5bc9250ccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,6 +70,9 @@ class Html
$html = '<body>' . $html . '</body>'; $html = '<body>' . $html . '</body>';
} }
//need to remove whitespaces between tags, as loadHTML seems to take those into account
$html = preg_replace('/(\>)\s*(\<)/m', '$1$2', $html);
// Load DOM // Load DOM
libxml_disable_entity_loader(true); libxml_disable_entity_loader(true);
$dom = new \DOMDocument(); $dom = new \DOMDocument();
@ -77,6 +80,7 @@ class Html
$dom->loadHTML($html, LIBXML_NOWARNING); $dom->loadHTML($html, LIBXML_NOWARNING);
self::$xpath = new \DOMXPath($dom); self::$xpath = new \DOMXPath($dom);
$node = $dom->getElementsByTagName('body'); $node = $dom->getElementsByTagName('body');
self::parseNode($node->item(0), $element); self::parseNode($node->item(0), $element);
} }