You are here

public function DOMTreeBuilderTest::testSVG in Zircon Profile 8

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

File

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

Class

DOMTreeBuilderTest
These tests are functional, not necessarily unit tests.

Namespace

Masterminds\HTML5\Tests\Parser

Code

public function testSVG() {
  $html = '<!doctype html>
      <html lang="en">
        <body>
          <svg width="150" height="100" viewBox="0 0 3 2" xmlns="http://www.w3.org/2000/svg">
            <rect width="1" height="2" x="2" fill="#d2232c" />
            <text font-family="Verdana" font-size="32">
              <textpath xlink:href="#Foo">
                Test Text.
              </textPath>
            </text>
          </svg>
        </body>
      </html>';
  $doc = $this
    ->parse($html);
  $svg = $doc
    ->getElementsByTagName('svg')
    ->item(0);
  $this
    ->assertEquals('svg', $svg->tagName);
  $this
    ->assertEquals('svg', $svg->nodeName);
  $this
    ->assertEquals('svg', $svg->localName);
  $this
    ->assertEquals('http://www.w3.org/2000/svg', $svg->namespaceURI);
  $textPath = $doc
    ->getElementsByTagName('textPath')
    ->item(0);
  $this
    ->assertEquals('textPath', $textPath->tagName);
}