コード例 #1
0
ファイル: EnvironmentTest.php プロジェクト: apishka/templater
 public function testAddExtension()
 {
     $twig = new Apishka_Templater_Environment($this->createMock('Apishka_Templater_LoaderInterface'));
     $twig->addExtension(new Apishka_Tests_Templater_EnvironmentTest_Extension());
     $this->assertArrayHasKey('test', $twig->getTags());
     $this->assertArrayHasKey('foo_filter', $twig->getFilters());
     $this->assertArrayHasKey('foo_function', $twig->getFunctions());
     $this->assertArrayHasKey('foo_test', $twig->getTests());
     $this->assertArrayHasKey('foo_unary', $twig->getUnaryOperators());
     $this->assertArrayHasKey('foo_binary', $twig->getBinaryOperators());
     $visitors = $twig->getNodeVisitors();
     $this->assertEquals('Apishka_Tests_Templater_EnvironmentTest_NodeVisitor', get_class($visitors[2]));
 }