You are here

public function StringInputStreamTest::testInvalidReplace in Zircon Profile 8

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

File

vendor/masterminds/html5/test/HTML5/Parser/StringInputStreamTest.php, line 197

Class

StringInputStreamTest

Namespace

Masterminds\HTML5\Tests\Parser

Code

public function testInvalidReplace() {
  $invalidTest = array(
    // Min/max overlong
    "" => 'Overlong representation of U+0000',
    "" => 'Overlong representation of U+0000',
    "" => 'Overlong representation of U+0000',
    "" => 'Overlong representation of U+0000',
    "" => 'Overlong representation of U+0000',
    "" => 'Overlong representation of U+007F',
    "" => 'Overlong representation of U+07FF',
    "" => 'Overlong representation of U+FFFF',
    "" => 'Incomplete two byte sequence (missing final byte)',
    "" => 'Incomplete three byte sequence (missing final byte)',
    "" => 'Incomplete four byte sequence (missing final byte)',
    // Min/max continuation bytes
    "" => 'Lone 80 continuation byte',
    "" => 'Lone BF continuation byte',
    // Invalid bytes (these can never occur)
    "" => 'Invalid FE byte',
    "" => 'Invalid FF byte',
  );
  foreach ($invalidTest as $test => $note) {
    $stream = new StringInputStream($test);
    $this
      ->assertEquals('a', $stream
      ->remainingChars(), $note);
  }

  // MPB:
  // It appears that iconv just leaves these alone. Not sure what to
  // do.

  /*
   * $converted = array( "a\xF5\x90\x80\x80" => 'U+110000, off unicode planes.', ); foreach ($converted as $test => $note) { $stream = new StringInputStream($test); $this->assertEquals(2, mb_strlen($stream->remainingChars()), $note); }
   */
}