public function testParseIsReentrant() { $twig = new Apishka_Templater_Environment($this->createMock('Apishka_Templater_LoaderInterface'), array('autoescape' => false, 'optimizations' => 0)); $twig->addTokenParser(new TestTokenParser()); $parser = new Apishka_Templater_Parser($twig); $parser->parse(new Apishka_Templater_TokenStream(array(new Apishka_Templater_Token(Apishka_Templater_Token::BLOCK_START_TYPE, '', 1), new Apishka_Templater_Token(Apishka_Templater_Token::NAME_TYPE, 'test', 1), new Apishka_Templater_Token(Apishka_Templater_Token::BLOCK_END_TYPE, '', 1), new Apishka_Templater_Token(Apishka_Templater_Token::VAR_START_TYPE, '', 1), new Apishka_Templater_Token(Apishka_Templater_Token::NAME_TYPE, 'foo', 1), new Apishka_Templater_Token(Apishka_Templater_Token::VAR_END_TYPE, '', 1), new Apishka_Templater_Token(Apishka_Templater_Token::EOF_TYPE, '', 1)))); $this->assertNull($parser->getParent()); }
/** * @expectedException Apishka_Templater_Error_Syntax * @expectedExceptionMessage The "block" function takes at least one argument (the variable and the attributes) in "index" at line 1. */ public function testBlockNoArgs() { $env = new Apishka_Templater_Environment($this->createMock('Apishka_Templater_LoaderInterface'), array('cache' => false, 'autoescape' => false)); $parser = new Apishka_Templater_Parser($env); $parser->parse($env->tokenize('{{ block() }}', 'index')); }