diff --git a/tests/cases/TestParser.php b/tests/cases/TestParser.php index 9ccf580..8b428bf 100644 --- a/tests/cases/TestParser.php +++ b/tests/cases/TestParser.php @@ -90,4 +90,24 @@ class TestParser extends \PHPUnit\Framework\TestCase { $this->expectExceptionCode(Exception::INVALID_DOCUMENT_CLASS); Parser::parse($in, "utf8", $conf); } + + public function testParseCheckingAttributeCoercion(): void { + $document = Parser::parse('
No coercion should occur here
', "UTF-8")->document; + $act = []; + foreach($document->getElementsByTagName("article")[0]->attributes as $a) { + $act[] = [ + 'ns' => $a->namespaceURI, + 'prefix' => $a->prefix, + 'name' => $a->localName, + 'value' => $a->value, + ]; + } + $exp = [[ + 'ns' => null, + 'prefix' => '', + 'name' => "xmlns:xlink", + 'value' => "http://www.w3.org/1999/xlink", + ]]; + $this->assertSame($exp, $act); + } }