Last active
October 25, 2019 14:44
-
-
Save MrMadClown/0799805d63d55c3e7066702f4037b312 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> — <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