diff --git a/lib/Twig/Test/IntegrationTestCase.php b/lib/Twig/Test/IntegrationTestCase.php index 899c3aaf9..016951aa6 100644 --- a/lib/Twig/Test/IntegrationTestCase.php +++ b/lib/Twig/Test/IntegrationTestCase.php @@ -24,6 +24,14 @@ abstract class Twig_Test_IntegrationTestCase extends TestCase */ abstract protected function getFixturesDir(); + /** + * @return Twig_RuntimeLoaderInterface[] + */ + protected function getRuntimeLoaders() + { + return array(); + } + /** * @return Twig_ExtensionInterface[] */ @@ -143,6 +151,10 @@ abstract class Twig_Test_IntegrationTestCase extends TestCase ), $match[2] ? eval($match[2].';') : array()); $twig = new Twig_Environment($loader, $config); $twig->addGlobal('global', 'global'); + foreach ($this->getRuntimeLoaders() as $runtimeLoader) { + $twig->addRuntimeLoader($runtimeLoader); + } + foreach ($this->getExtensions() as $extension) { $twig->addExtension($extension); }