@dataProvider getAttributeExceptions
public function testGetAttributeExceptions($template, $message, $useExt) {
$name = 'index_' . ($useExt ? 1 : 0);
$templates = array(
$name => $template . $useExt,
);
$env = new Twig_Environment(new Twig_Loader_Array($templates), array(
'strict_variables' => true,
));
if (!$useExt) {
$env
->addNodeVisitor(new CExtDisablingNodeVisitor());
}
$template = $env
->loadTemplate($name);
$context = array(
'string' => 'foo',
'array' => array(
'foo' => 'foo',
),
'array_access' => new Twig_TemplateArrayAccessObject(),
);
try {
$template
->render($context);
} catch (Twig_Error_Runtime $e) {
$this
->assertEquals(sprintf($message, $name), $e
->getMessage());
}
}