public function Twig_Tests_LexerTest::testLineDirective in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/twig/twig/test/Twig/Tests/LexerTest.php \Twig_Tests_LexerTest::testLineDirective()
File
- vendor/
twig/ twig/ test/ Twig/ Tests/ LexerTest.php, line 61
Class
Code
public function testLineDirective() {
$template = "foo\n" . "bar\n" . "{% line 10 %}\n" . "{{\n" . "baz\n" . "}}\n";
$lexer = new Twig_Lexer(new Twig_Environment($this
->getMock('Twig_LoaderInterface')));
$stream = $lexer
->tokenize($template);
// foo\nbar\n
$this
->assertSame(1, $stream
->expect(Twig_Token::TEXT_TYPE)
->getLine());
// \n (after {% line %})
$this
->assertSame(10, $stream
->expect(Twig_Token::TEXT_TYPE)
->getLine());
// {{
$this
->assertSame(11, $stream
->expect(Twig_Token::VAR_START_TYPE)
->getLine());
// baz
$this
->assertSame(12, $stream
->expect(Twig_Token::NAME_TYPE)
->getLine());
}