You are here

public function DOMTreeBuilderTest::testCustomImplicitNamespaces in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php \Masterminds\HTML5\Tests\Parser\DOMTreeBuilderTest::testCustomImplicitNamespaces()

File

vendor/masterminds/html5/test/HTML5/Parser/DOMTreeBuilderTest.php, line 160
Test the Tree Builder.

Class

DOMTreeBuilderTest
These tests are functional, not necessarily unit tests.

Namespace

Masterminds\HTML5\Tests\Parser

Code

public function testCustomImplicitNamespaces() {
  $dom = $this
    ->parse('<!DOCTYPE html><html><body><a t:href="bar">foo</a></body></html>', array(
    'implicitNamespaces' => array(
      't' => 'http://www.example.com',
    ),
  ));
  $a = $dom
    ->getElementsByTagName('a')
    ->item(0);
  $attr = $a
    ->getAttributeNode('t:href');
  $this
    ->assertEquals('http://www.example.com', $attr->namespaceURI);
  $dom = $this
    ->parse('<!DOCTYPE html><html><body><t:a>foo</t:a></body></html>', array(
    'implicitNamespaces' => array(
      't' => 'http://www.example.com',
    ),
  ));
  $list = $dom
    ->getElementsByTagNameNS('http://www.example.com', 'a');
  $this
    ->assertEquals(1, $list->length);
}