You are here

protected function TokenizerTest::isAllGood in Zircon Profile 8

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

Asserts that all of the tests are good.

This loops through a map of tests/expectations and runs a few assertions on each test.

Checks:

  • depth (if depth is > 0)
  • event name
  • matches on event 0.
7 calls to TokenizerTest::isAllGood()
TokenizerTest::testCDATASection in vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php
TokenizerTest::testCharacterReference in vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php
TokenizerTest::testDoctype in vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php
TokenizerTest::testEndTag in vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php
TokenizerTest::testProcessorInstruction in vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php

... See full list

File

vendor/masterminds/html5/test/HTML5/Parser/TokenizerTest.php, line 50

Class

TokenizerTest

Namespace

Masterminds\HTML5\Tests\Parser

Code

protected function isAllGood($name, $depth, $tests, $debug = false) {
  foreach ($tests as $try => $expects) {
    if ($debug) {
      fprintf(STDOUT, "%s expects %s\n", $try, print_r($expects, true));
    }
    $e = $this
      ->parse($try);
    if ($depth > 0) {
      $this
        ->assertEquals($depth, $e
        ->depth(), "Expected depth {$depth} for test {$try}." . print_r($e, true));
    }
    $this
      ->assertEventEquals($name, $expects, $e
      ->get(0));
  }
}