add test for parsing HTML containing entities
This commit is contained in:
parent
78ffbff0c1
commit
7aef21faca
|
|
@ -86,6 +86,21 @@ class HtmlTest extends \PHPUnit\Framework\TestCase
|
|||
$this->assertCount(2, $section->getElements());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test HTML entities
|
||||
*/
|
||||
public function testParseHtmlEntities()
|
||||
{
|
||||
\PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true);
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
Html::addHtml($section, 'text with entities <my text>');
|
||||
|
||||
$doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');
|
||||
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p[1]/w:r/w:t'));
|
||||
$this->assertEquals('text with entities <my text>', $doc->getElement('/w:document/w:body/w:p[1]/w:r/w:t')->nodeValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test underline
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue