From f839ad328e442066a756b27fdefe4e1a769ca7b9 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 25 Oct 2015 08:12:33 +0100 Subject: [PATCH] made the tests semantically more correct --- test/Twig/Tests/EnvironmentTest.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/Twig/Tests/EnvironmentTest.php b/test/Twig/Tests/EnvironmentTest.php index 57b91ae50..ef79a62e4 100644 --- a/test/Twig/Tests/EnvironmentTest.php +++ b/test/Twig/Tests/EnvironmentTest.php @@ -54,11 +54,11 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase $globals = $twig->getGlobals(); $this->assertEquals('bar', $globals['foo']); - // globals can be modified after runtime init + // globals can be modified after a template has been loaded $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); $twig->addGlobal('foo', 'foo'); $twig->getGlobals(); - $twig->initRuntime(); + $twig->loadTemplate('index'); $twig->addGlobal('foo', 'bar'); $globals = $twig->getGlobals(); $this->assertEquals('bar', $globals['foo']); @@ -72,12 +72,12 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase $globals = $twig->getGlobals(); $this->assertEquals('bar', $globals['foo']); - // globals can be modified after extensions and runtime init + // globals can be modified after extensions and a template has been loaded $twig = new Twig_Environment($loader = new Twig_Loader_Array(array('index' => '{{foo}}'))); $twig->addGlobal('foo', 'foo'); $twig->getGlobals(); $twig->getFunctions(); - $twig->initRuntime(); + $twig->loadTemplate('index'); $twig->addGlobal('foo', 'bar'); $globals = $twig->getGlobals(); $this->assertEquals('bar', $globals['foo']); @@ -89,11 +89,11 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase $this->assertEquals('bar', $template->render(array())); /* to be uncomment in Twig 2.0 - // globals cannot be added after runtime init + // globals cannot be added after a template has been loaded $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); $twig->addGlobal('foo', 'foo'); $twig->getGlobals(); - $twig->initRuntime(); + $twig->loadTemplate('index'); try { $twig->addGlobal('bar', 'bar'); $this->fail(); @@ -113,12 +113,12 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); } - // globals cannot be added after extensions and runtime init + // globals cannot be added after extensions and a template has been loaded $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); $twig->addGlobal('foo', 'foo'); $twig->getGlobals(); $twig->getFunctions(); - $twig->initRuntime(); + $twig->loadTemplate('index'); try { $twig->addGlobal('bar', 'bar'); $this->fail(); @@ -126,9 +126,9 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase $this->assertFalse(array_key_exists('bar', $twig->getGlobals())); } - // test adding globals after initRuntime without call to getGlobals + // test adding globals after a template has been loaded without call to getGlobals $twig = new Twig_Environment($this->getMock('Twig_LoaderInterface')); - $twig->initRuntime(); + $twig->loadTemplate('index'); try { $twig->addGlobal('bar', 'bar'); $this->fail();