mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 19:06:40 +00:00
removed some usage of loadTemplate in tests
This commit is contained in:
@@ -105,7 +105,7 @@ class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase
|
||||
$twig = new Environment($loader);
|
||||
$twig->addGlobal('foo', 'foo');
|
||||
$twig->getGlobals();
|
||||
$twig->loadTemplate('index');
|
||||
$twig->load('index');
|
||||
$twig->addGlobal('foo', 'bar');
|
||||
$globals = $twig->getGlobals();
|
||||
$this->assertEquals('bar', $globals['foo']);
|
||||
@@ -125,7 +125,7 @@ class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase
|
||||
$twig->addGlobal('foo', 'foo');
|
||||
$twig->getGlobals();
|
||||
$twig->getFunctions();
|
||||
$twig->loadTemplate('index');
|
||||
$twig->load('index');
|
||||
$twig->addGlobal('foo', 'bar');
|
||||
$globals = $twig->getGlobals();
|
||||
$this->assertEquals('bar', $globals['foo']);
|
||||
@@ -133,7 +133,7 @@ class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase
|
||||
$twig = new Environment($arrayLoader);
|
||||
$twig->getGlobals();
|
||||
$twig->addGlobal('foo', 'bar');
|
||||
$template = $twig->loadTemplate('index');
|
||||
$template = $twig->load('index');
|
||||
$this->assertEquals('bar', $template->render([]));
|
||||
|
||||
/* to be uncomment in Twig 2.0
|
||||
@@ -141,7 +141,7 @@ class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase
|
||||
$twig = new Environment($loader);
|
||||
$twig->addGlobal('foo', 'foo');
|
||||
$twig->getGlobals();
|
||||
$twig->loadTemplate('index');
|
||||
$twig->load('index');
|
||||
try {
|
||||
$twig->addGlobal('bar', 'bar');
|
||||
$this->fail();
|
||||
@@ -166,7 +166,7 @@ class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase
|
||||
$twig->addGlobal('foo', 'foo');
|
||||
$twig->getGlobals();
|
||||
$twig->getFunctions();
|
||||
$twig->loadTemplate('index');
|
||||
$twig->load('index');
|
||||
try {
|
||||
$twig->addGlobal('bar', 'bar');
|
||||
$this->fail();
|
||||
@@ -176,7 +176,7 @@ class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
// test adding globals after a template has been loaded without call to getGlobals
|
||||
$twig = new Environment($loader);
|
||||
$twig->loadTemplate('index');
|
||||
$twig->load('index');
|
||||
try {
|
||||
$twig->addGlobal('bar', 'bar');
|
||||
$this->fail();
|
||||
@@ -238,7 +238,7 @@ class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase
|
||||
$cache->expects($this->once())
|
||||
->method('load');
|
||||
|
||||
$twig->loadTemplate($templateName);
|
||||
$twig->load($templateName);
|
||||
}
|
||||
|
||||
public function testAutoReloadCacheHit()
|
||||
@@ -266,7 +266,7 @@ class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase
|
||||
$cache->expects($this->atLeastOnce())
|
||||
->method('load');
|
||||
|
||||
$twig->loadTemplate($templateName);
|
||||
$twig->load($templateName);
|
||||
}
|
||||
|
||||
public function testAutoReloadOutdatedCacheHit()
|
||||
@@ -294,7 +294,7 @@ class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase
|
||||
$cache->expects($this->once())
|
||||
->method('load');
|
||||
|
||||
$twig->loadTemplate($templateName);
|
||||
$twig->load($templateName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -508,7 +508,7 @@ EOF
|
||||
'base.html.twig' => '{% extends "base.html.twig" %}',
|
||||
]));
|
||||
|
||||
$twig->loadTemplate('base.html.twig');
|
||||
$twig->load('base.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -522,7 +522,7 @@ EOF
|
||||
'base2.html.twig' => '{% extends "base1.html.twig" %}',
|
||||
]));
|
||||
|
||||
$twig->loadTemplate('base1.html.twig');
|
||||
$twig->load('base1.html.twig');
|
||||
}
|
||||
|
||||
protected function getMockLoader($templateName, $templateContent)
|
||||
|
||||
@@ -118,7 +118,7 @@ class Twig_Tests_Extension_SandboxTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$twig = $this->getEnvironment(true, [], ['index' => $template], [], ['upper'], ['FooObject' => 'getAnotherFooObject'], [], ['random']);
|
||||
try {
|
||||
$twig->loadTemplate('index')->render(self::$params);
|
||||
$twig->load('index')->render(self::$params);
|
||||
$this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template');
|
||||
} catch (SecurityError $e) {
|
||||
$this->assertInstanceOf('\Twig\Sandbox\SecurityNotAllowedMethodError', $e, 'Exception should be an instance of Twig_Sandbox_SecurityNotAllowedMethodError');
|
||||
|
||||
@@ -44,7 +44,7 @@ class Twig_Tests_FileCachingTest extends \PHPUnit\Framework\TestCase
|
||||
public function testWritingCacheFiles()
|
||||
{
|
||||
$name = 'index';
|
||||
$this->env->loadTemplate($name);
|
||||
$this->env->load($name);
|
||||
$cacheFileName = $this->env->getCacheFilename($name);
|
||||
|
||||
$this->assertFileExists($cacheFileName, 'Cache file does not exist.');
|
||||
@@ -56,7 +56,7 @@ class Twig_Tests_FileCachingTest extends \PHPUnit\Framework\TestCase
|
||||
public function testClearingCacheFiles()
|
||||
{
|
||||
$name = 'index2';
|
||||
$this->env->loadTemplate($name);
|
||||
$this->env->load($name);
|
||||
$cacheFileName = $this->env->getCacheFilename($name);
|
||||
|
||||
$this->assertFileExists($cacheFileName, 'Cache file does not exist.');
|
||||
|
||||
Reference in New Issue
Block a user