public function TokenizerTest::testEndTag in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php \Masterminds\HTML5\Tests\Parser\TokenizerTest::testEndTag()
File
- vendor/
masterminds/ html5/ test/ HTML5/ Parser/ TokenizerTest.php, line 146
Class
Namespace
Masterminds\HTML5\Tests\ParserCode
public function testEndTag() {
$succeed = array(
'</a>' => 'a',
'</test>' => 'test',
'</test
>' => 'test',
'</thisIsTheTagThatDoesntEndItJustGoesOnAndOnMyFriend>' => 'thisisthetagthatdoesntenditjustgoesonandonmyfriend',
// See 8.2.4.10, which requires this and does not say error.
'</a<b>' => 'a<b',
);
$this
->isAllGood('endTag', 2, $succeed);
// Recoverable failures
$fail = array(
'</a class="monkey">' => 'a',
'</a <b>' => 'a',
'</a <b <c>' => 'a',
'</a is the loneliest letter>' => 'a',
'</a' => 'a',
);
foreach ($fail as $test => $result) {
$events = $this
->parse($test);
$this
->assertEquals(3, $events
->depth());
// Should have triggered an error.
$this
->assertEventError($events
->get(0));
// Should have tried to parse anyway.
$this
->assertEventEquals('endTag', $result, $events
->get(1));
}
// BogoComments
$comments = array(
'</>' => '</>',
'</ >' => '</ >',
'</ a>' => '</ a>',
);
foreach ($comments as $test => $result) {
$events = $this
->parse($test);
$this
->assertEquals(3, $events
->depth());
// Should have triggered an error.
$this
->assertEventError($events
->get(0));
// Should have tried to parse anyway.
$this
->assertEventEquals('comment', $result, $events
->get(1));
}
}