+ public function testSandboxUnallowedRangeOperator()
+ {
+ $twig = $this->getEnvironment(true, array(), self::$templates);
+ try {
+ $twig->loadTemplate('1_range_operator')->render(self::$params);
+ $this->fail('Sandbox throws a SecurityError exception if the unallowed range operator is called');
+ } catch (Twig_Sandbox_SecurityError $e) {
+ $this->assertInstanceOf('Twig_Sandbox_SecurityNotAllowedFunctionError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedFunctionError');
+ $this->assertEquals('range', $e->getFunctionName(), 'Exception should be raised on the "range" function');
+ }
+ }
+