public function testRuntimeLoader() { $container =
$this->
createContainer();
$container->
registerExtension(new TwigExtension());
$container->
loadFromExtension('twig'
);
$container->
setParameter('kernel.environment', 'test'
);
$container->
setParameter('debug.file_link_format', 'test'
);
$container->
setParameter('foo', 'FooClass'
);
$container->
register('http_kernel', 'FooClass'
);
$container->
register('foo', '%foo%'
)->
addTag('twig.runtime'
);
$container->
register('error_renderer.html', HtmlErrorRenderer::
class);
$container->
addCompilerPass(new RuntimeLoaderPass(), PassConfig::TYPE_BEFORE_REMOVING
);
$container->
getCompilerPassConfig()->
setRemovingPasses([]);
$container->
getCompilerPassConfig()->
setAfterRemovingPasses([]);
$container->
compile();
$loader =
$container->
getDefinition('twig.runtime_loader'
);
$args =
$container->
getDefinition((string) $loader->
getArgument(0
))->
getArgument(0
);
$this->
assertArrayHasKey(FormRenderer::
class,
$args);
$this->
assertArrayHasKey('FooClass',
$args);
$this->
assertEquals('twig.form.renderer',
$args[FormRenderer::
class]->
getValues()[0
]);
$this->
assertEquals('foo',
$args['FooClass'
]->
getValues()[0
]);
}