You are here

public function TokenizerTest::testCharacterReference 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::testCharacterReference()

File

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

Class

TokenizerTest

Namespace

Masterminds\HTML5\Tests\Parser

Code

public function testCharacterReference() {
  $good = array(
    '&' => '&',
    '&#x0003c;' => '<',
    '&#38;' => '&',
    '&' => '&',
  );
  $this
    ->isAllGood('text', 2, $good);

  // Test with broken charref
  $str = '&foo';
  $events = $this
    ->parse($str);
  $e1 = $events
    ->get(0);
  $this
    ->assertEquals('error', $e1['name']);
  $str = '&#xfoo';
  $events = $this
    ->parse($str);
  $e1 = $events
    ->get(0);
  $this
    ->assertEquals('error', $e1['name']);
  $str = '&#foo';
  $events = $this
    ->parse($str);
  $e1 = $events
    ->get(0);
  $this
    ->assertEquals('error', $e1['name']);

  // FIXME: Once the text processor is done, need to verify that the
  // tokens are transformed correctly into text.
}