public function Twig_Tests_EnvironmentTest::testAddExtension

File

drupal/core/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php, line 169

Class

Twig_Tests_EnvironmentTest

Code

public function testAddExtension() {
  $twig = new Twig_Environment(new Twig_Loader_String());
  $twig
    ->addExtension(new Twig_Tests_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());
  $this
    ->assertArrayHasKey('foo_global', $twig
    ->getGlobals());
  $visitors = $twig
    ->getNodeVisitors();
  $this
    ->assertEquals('Twig_Tests_EnvironmentTest_NodeVisitor', get_class($visitors[2]));
}