Skip to content

Commit

Permalink
Added test for sandbox __toString when not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
scottasmith committed Apr 15, 2014
1 parent 8dfa432 commit 3ce4202
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/Twig/Tests/Extension/SandboxTest.php
Expand Up @@ -111,6 +111,11 @@ public function testSandboxGloballySet()
$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');

Expand Down

0 comments on commit 3ce4202

Please sign in to comment.