You are here

public function StringInputStreamTest::testCurrentLine in Zircon Profile 8.0

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

File

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

Class

StringInputStreamTest

Namespace

Masterminds\HTML5\Tests\Parser

Code

public function testCurrentLine() {
  $txt = "1\n2\n\n\n\n3";
  $stream = new StringInputStream($txt);
  $this
    ->assertEquals(1, $stream
    ->currentLine());

  // Advance over 1 and LF on to line 2 value 2.
  $stream
    ->next();
  $stream
    ->next();
  $canary = $stream
    ->current();
  $this
    ->assertEquals(2, $stream
    ->currentLine());
  $this
    ->assertEquals('2', $canary);

  // Advance over 4x LF
  $stream
    ->next();
  $stream
    ->next();
  $stream
    ->next();
  $stream
    ->next();
  $stream
    ->next();
  $this
    ->assertEquals(6, $stream
    ->currentLine());
  $this
    ->assertEquals('3', $stream
    ->current());

  // Make sure it doesn't do 7.
  $this
    ->assertEquals(6, $stream
    ->currentLine());
}