You are here

public function Html5Test::testMathMl in Zircon Profile 8.0

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

File

vendor/masterminds/html5/test/HTML5/Html5Test.php, line 218

Class

Html5Test

Namespace

Masterminds\HTML5\Tests

Code

public function testMathMl() {
  $dom = $this->html5
    ->loadHTML('<!doctype html>
      <html lang="en">
        <body>
          <div id="foo" class="bar baz" definitionURL="http://example.com">foo bar baz</div>
          <math>
            <mi>x</mi>
            <csymbol definitionURL="http://www.example.com/mathops/multiops.html#plusminus">
              <mo>&PlusMinus;</mo>
            </csymbol>
            <mi>y</mi>
          </math>
        </body>
      </html>');
  $this
    ->assertEmpty($this->html5
    ->getErrors());
  $list = $dom
    ->getElementsByTagName('math');
  $this
    ->assertNotEmpty($list->length);
  $list = $dom
    ->getElementsByTagName('div');
  $this
    ->assertNotEmpty($list->length);
  $div = $list
    ->item(0);
  $this
    ->assertEquals('http://example.com', $div
    ->getAttribute('definitionurl'));
  $this
    ->assertFalse($div
    ->hasAttribute('definitionURL'));
  $list = $dom
    ->getElementsByTagName('csymbol');
  $csymbol = $list
    ->item(0);
  $this
    ->assertEquals('http://www.example.com/mathops/multiops.html#plusminus', $csymbol
    ->getAttribute('definitionURL'));
  $this
    ->assertFalse($csymbol
    ->hasAttribute('definitionurl'));
  $html = $this->html5
    ->saveHTML($dom);
  $this
    ->assertRegExp('|<csymbol definitionURL="http://www.example.com/mathops/multiops.html#plusminus">|', $html);
  $this
    ->assertRegExp('|<mi>y</mi>|', $html);
}