Added test for sandbox __toString when not enabled
authorScott Smith <smitherz82@gmail.com>
Tue, 15 Apr 2014 18:03:53 +0000 (19:03 +0100)
committerScott Smith <smitherz82@gmail.com>
Tue, 15 Apr 2014 18:03:53 +0000 (19:03 +0100)
test/Twig/Tests/Extension/SandboxTest.php

index e4746cb..1022338 100644 (file)
@@ -111,6 +111,11 @@ class Twig_Tests_Extension_SandboxTest extends PHPUnit_Framework_TestCase
         $this->assertEquals('foo', $twig->loadTemplate('1_basic5')->render(self::$params), 'Sandbox allow some methods');
         $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once');
 
+        $twig = $this->getEnvironment(false, array(), self::$templates);
+        FooObject::reset();
+        $this->assertEquals('foo', $twig->loadTemplate('1_basic5')->render(self::$params), 'Sandbox allows __toString when sandbox disabled');
+        $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once');
+
         $twig = $this->getEnvironment(true, array(), self::$templates, array(), array('upper'));
         $this->assertEquals('FABIEN', $twig->loadTemplate('1_basic2')->render(self::$params), 'Sandbox allow some filters');