@dataProvider getGetAttributeWithSandbox
public function testGetAttributeWithSandbox($object, $item, $allowed, $useExt) {
$twig = new Twig_Environment();
$policy = new Twig_Sandbox_SecurityPolicy(array(), array(), array(), array(), array());
$twig
->addExtension(new Twig_Extension_Sandbox($policy, !$allowed));
$template = new Twig_TemplateTest($twig, $useExt);
try {
$template
->getAttribute($object, $item, array(), 'any');
if (!$allowed) {
$this
->fail();
}
} catch (Twig_Sandbox_SecurityError $e) {
if ($allowed) {
$this
->fail();
}
$this
->assertContains('is not allowed', $e
->getMessage());
}
}