Skip to content

Commit

Permalink
testLoadHtml generate original html string from xml
Browse files Browse the repository at this point in the history
Tests:
- Convert a html string to SimpleXmlElement
- Access to html nodes in SimpleXmlElement
- Nodes content
- Regenerate the original  html string from SimpleXmlElement
  • Loading branch information
alphp committed Jun 2, 2018
1 parent 6265846 commit 6572d67
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/TestCase/Utility/XmlTest.php
Expand Up @@ -270,12 +270,14 @@ public function testLoadHtml()
$this->assertEquals($paragraph, (string)$xml->body->p);
$this->assertTrue(isset($xml->body->blockquote), 'Blockquote present');
$this->assertEquals($blockquote, (string)$xml->body->blockquote);
$this->assertEquals($html, "<!DOCTYPE html>\n" . $xml->asXML());

$xml = Xml::loadHtml($html, ['parseHuge' => true]);
$this->assertTrue(isset($xml->body->p), 'Paragraph present');
$this->assertEquals($paragraph, (string)$xml->body->p);
$this->assertTrue(isset($xml->body->blockquote), 'Blockquote present');
$this->assertEquals($blockquote, (string)$xml->body->blockquote);
$this->assertEquals($html, "<!DOCTYPE html>\n" . $xml->asXML());
}

/**
Expand Down

0 comments on commit 6572d67

Please sign in to comment.