Skip to content

Instantly share code, notes, and snippets.

@MrMadClown
Last active October 25, 2019 14:44
Show Gist options
  • Save MrMadClown/0799805d63d55c3e7066702f4037b312 to your computer and use it in GitHub Desktop.
Save MrMadClown/0799805d63d55c3e7066702f4037b312 to your computer and use it in GitHub Desktop.
<?php
/**
* Luca Perna - Webdeveloper
* Team Dementia
* luc@rissc.com
*
* Date: 25.10.19
*/
namespace Tests\Unit;
use DOMXPath;
use IvoPetkov\HTML5DOMDocument;
use PHPUnit\Framework\TestCase;
class Html5DomDocumentTest extends TestCase
{
public function testInternalEntityRevealedByXPath()
{
$dom = '<html><body><p><span>Lorem Ipsum</span> &mdash; <span>dolor sit amet,</span></p></body></html>';
$domDoc = new HTML5DOMDocument('1.0', 'utf-8');
$domDoc->loadHTML($dom);
$xpath = new DOMXPath($domDoc);
$nodeList = $xpath->query('//p');
foreach ($nodeList as $node) {
static::assertEquals('Lorem Ipsum html5-dom-document-internal-entity1-mdash-end dolor sit amet,', $node->nodeValue);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment