html5Elements as $element) {
$this->assertTrue(Elements::isHtml5Element($element), 'html5 element test failed on: ' . $element);
$this->assertTrue(Elements::isHtml5Element(strtoupper($element)), 'html5 element test failed on: ' . strtoupper($element));
}
$nonhtml5 = array('foo', 'bar', 'baz');
foreach ($nonhtml5 as $element) {
$this->assertFalse(Elements::isHtml5Element($element), 'html5 element test failed on: ' . $element);
$this->assertFalse(Elements::isHtml5Element(strtoupper($element)), 'html5 element test failed on: ' . strtoupper($element));
}
}
public function testIsMathMLElement() {
foreach ($this->mathmlElements as $element) {
$this->assertTrue(Elements::isMathMLElement($element), 'MathML element test failed on: ' . $element);
// MathML is case sensetitive so these should all fail.
$this->assertFalse(Elements::isMathMLElement(strtoupper($element)), 'MathML element test failed on: ' . strtoupper($element));
}
$nonMathML = array('foo', 'bar', 'baz');
foreach ($nonMathML as $element) {
$this->assertFalse(Elements::isMathMLElement($element), 'MathML element test failed on: ' . $element);
}
}
public function testIsSvgElement() {
foreach ($this->svgElements as $element) {
$this->assertTrue(Elements::isSvgElement($element), 'SVG element test failed on: ' . $element);
// SVG is case sensetitive so these should all fail.
$this->assertFalse(Elements::isSvgElement(strtoupper($element)), 'SVG element test failed on: ' . strtoupper($element));
}
$nonSVG = array('foo', 'bar', 'baz');
foreach ($nonSVG as $element) {
$this->assertFalse(Elements::isSvgElement($element), 'SVG element test failed on: ' . $element);
}
}
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));
}
}
public function testElement() {
foreach ($this->html5Elements as $element) {
$this->assertGreaterThan(0, Elements::element($element));
}
$nonhtml5 = array('foo', 'bar', 'baz');
foreach ($nonhtml5 as $element) {
$this->assertFalse(Elements::element($element));
}
}
public function testIsA() {
$this->assertTrue(Elements::isA('script', Elements::KNOWN_ELEMENT));
$this->assertFalse(Elements::isA('scriptypoo', Elements::KNOWN_ELEMENT));
$this->assertTrue(Elements::isA('script', Elements::TEXT_RAW));
$this->assertFalse(Elements::isA('script', Elements::TEXT_RCDATA));
}
}