예제 #1
0
 public function testParseIsReentrant()
 {
     $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'), array('autoescape' => false, 'optimizations' => 0));
     $twig->addTokenParser(new TestTokenParser());
     $parser = new Twig_Parser($twig);
     $parser->parse(new Twig_TokenStream(array(new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), new Twig_Token(Twig_Token::NAME_TYPE, 'test', 1), new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), new Twig_Token(Twig_Token::VAR_START_TYPE, '', 1), new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 1), new Twig_Token(Twig_Token::VAR_END_TYPE, '', 1), new Twig_Token(Twig_Token::EOF_TYPE, '', 1))));
     $this->assertNull($parser->getParent());
 }
예제 #2
0
 public function testParseIsReentrant()
 {
     $twig = new Twig_Environment(null, ['autoescape' => false, 'optimizations' => 0]);
     $twig->addTokenParser(new TestTokenParser());
     $parser = new Twig_Parser($twig);
     $parser->parse(new Twig_TokenStream([new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 1), new Twig_Token(Twig_Token::NAME_TYPE, 'test', 1), new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 1), new Twig_Token(Twig_Token::VAR_START_TYPE, '', 1), new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 1), new Twig_Token(Twig_Token::VAR_END_TYPE, '', 1), new Twig_Token(Twig_Token::EOF_TYPE, '', 1)]));
     $this->assertNull($parser->getParent());
 }