mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-01 04:57:23 +00:00
Add support for runtime loaders to IntegrationTestCase
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user