You are here

public function Twig_Tests_LexerTest::testStringWithInterpolation in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/twig/twig/test/Twig/Tests/LexerTest.php \Twig_Tests_LexerTest::testStringWithInterpolation()

File

vendor/twig/twig/test/Twig/Tests/LexerTest.php, line 166

Class

Twig_Tests_LexerTest

Code

public function testStringWithInterpolation() {
  $template = 'foo {{ "bar #{ baz + 1 }" }}';
  $lexer = new Twig_Lexer(new Twig_Environment($this
    ->getMock('Twig_LoaderInterface')));
  $stream = $lexer
    ->tokenize($template);
  $stream
    ->expect(Twig_Token::TEXT_TYPE, 'foo ');
  $stream
    ->expect(Twig_Token::VAR_START_TYPE);
  $stream
    ->expect(Twig_Token::STRING_TYPE, 'bar ');
  $stream
    ->expect(Twig_Token::INTERPOLATION_START_TYPE);
  $stream
    ->expect(Twig_Token::NAME_TYPE, 'baz');
  $stream
    ->expect(Twig_Token::OPERATOR_TYPE, '+');
  $stream
    ->expect(Twig_Token::NUMBER_TYPE, '1');
  $stream
    ->expect(Twig_Token::INTERPOLATION_END_TYPE);
  $stream
    ->expect(Twig_Token::VAR_END_TYPE);
}