You are here

public function ElementsTest::testIsElement in Zircon Profile 8

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

File

vendor/masterminds/html5/test/HTML5/ElementsTest.php, line 305

Class

ElementsTest

Namespace

Masterminds\HTML5\Tests

Code

public function testIsElement() {
  foreach ($this->html5Elements as $element) {
    $this
      ->assertTrue(Elements::isElement($element), 'html5 element test failed on: ' . $element);
    $this
      ->assertTrue(Elements::isElement(strtoupper($element)), 'html5 element test failed on: ' . strtoupper($element));
  }
  foreach ($this->mathmlElements as $element) {
    $this
      ->assertTrue(Elements::isElement($element), 'MathML element test failed on: ' . $element);

    // MathML is case sensetitive so these should all fail.
    $this
      ->assertFalse(Elements::isElement(strtoupper($element)), 'MathML element test failed on: ' . strtoupper($element));
  }
  foreach ($this->svgElements as $element) {
    $this
      ->assertTrue(Elements::isElement($element), 'SVG element test failed on: ' . $element);

    // SVG is case sensetitive so these should all fail. But, there is duplication
    // html5 and SVG. Since html5 is case insensetitive we need to make sure
    // it's not a html5 element first.
    if (!in_array($element, $this->html5Elements)) {
      $this
        ->assertFalse(Elements::isElement(strtoupper($element)), 'SVG element test failed on: ' . strtoupper($element));
    }
  }
  $nonhtml5 = array(
    'foo',
    'bar',
    'baz',
  );
  foreach ($nonhtml5 as $element) {
    $this
      ->assertFalse(Elements::isElement($element), 'html5 element test failed on: ' . $element);
    $this
      ->assertFalse(Elements::isElement(strtoupper($element)), 'html5 element test failed on: ' . strtoupper($element));
  }
}