public function Twig_Tests_LexerTest::testLineDirectiveInline

File

drupal/core/vendor/twig/twig/test/Twig/Tests/LexerTest.php, line 84

Class

Twig_Tests_LexerTest

Code

public function testLineDirectiveInline() {
  $template = "foo\n" . "bar{% line 10 %}{{\n" . "baz\n" . "}}\n";
  $lexer = new Twig_Lexer(new Twig_Environment());
  $stream = $lexer
    ->tokenize($template);

  // foo\nbar
  $this
    ->assertSame(1, $stream
    ->expect(Twig_Token::TEXT_TYPE)
    ->getLine());

  // {{
  $this
    ->assertSame(10, $stream
    ->expect(Twig_Token::VAR_START_TYPE)
    ->getLine());

  // baz
  $this
    ->assertSame(11, $stream
    ->expect(Twig_Token::NAME_TYPE)
    ->getLine());
}