Skip to content

Commit

Permalink
Add test for loadHtml method
Browse files Browse the repository at this point in the history
  • Loading branch information
alphp committed Jun 2, 2018
1 parent 5d98e7a commit c0961d1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/Fixture/sample.html
@@ -0,0 +1,15 @@
<html>
<body>

<p>Browsers usually indent blockquote elements.</p>

<blockquote cite="http://www.worldwildlife.org/who/index.html">
For 50 years, WWF has been protecting the future of nature.
The world's leading conservation organization,
WWF works in 100 countries and is supported by
1.2 million members in the United States and
close to 5 million globally.
</blockquote>

</body>
</html>
14 changes: 14 additions & 0 deletions tests/TestCase/Utility/XmlTest.php
Expand Up @@ -247,6 +247,20 @@ public function testBuildEmptyTag()
}
}

/**
* testLoadHtml method
*
* @return void
*/
public function testLoadHtml()
{
$html = CORE_TESTS . 'Fixture/sample.html';
$html = file_get_contents($html);
$xml = Xml::loadHtml($html);
$xml = html_entity_decode($xml->asXML(), ENT_NOQUOTES, 'UTF-8');
$this->assertEquals($html, $xml);
}

/**
* testFromArray method
*
Expand Down

0 comments on commit c0961d1

Please sign in to comment.