// globals can be added after calling getGlobals
$twig = new Twig_Environment(new Twig_Loader_String());
$twig->addGlobal('foo', 'foo');
- $globals = $twig->getGlobals();
+ $twig->getGlobals();
$twig->addGlobal('foo', 'bar');
$globals = $twig->getGlobals();
$this->assertEquals('bar', $globals['foo']);
// globals can be modified after extensions init
$twig = new Twig_Environment(new Twig_Loader_String());
$twig->addGlobal('foo', 'foo');
- $globals = $twig->getGlobals();
+ $twig->getGlobals();
$twig->getFunctions();
$twig->addGlobal('foo', 'bar');
$globals = $twig->getGlobals();
// globals can be modified after extensions and runtime init
$twig = new Twig_Environment(new Twig_Loader_String());
$twig->addGlobal('foo', 'foo');
- $globals = $twig->getGlobals();
+ $twig->getGlobals();
$twig->getFunctions();
$twig->initRuntime();
$twig->addGlobal('foo', 'bar');
public function testWritingCacheFiles()
{
$name = 'This is just text.';
- $template = $this->env->loadTemplate($name);
+ $this->env->loadTemplate($name);
$cacheFileName = $this->env->getCacheFilename($name);
$this->assertTrue(file_exists($cacheFileName), 'Cache file does not exist.');
public function testClearingCacheFiles()
{
$name = 'I will be deleted.';
- $template = $this->env->loadTemplate($name);
+ $this->env->loadTemplate($name);
$cacheFileName = $this->env->getCacheFilename($name);
$this->assertTrue(file_exists($cacheFileName), 'Cache file does not exist.');
$stream = $lexer->tokenize($template);
$count = 0;
- $tokens = array();
while (!$stream->isEOF()) {
$token = $stream->next();
if ($type === $token->getType()) {
$template = '{% raw %}'.str_repeat('*', 100000).'{% endraw %}';
$lexer = new Twig_Lexer(new Twig_Environment());
- $stream = $lexer->tokenize($template);
+ $lexer->tokenize($template);
// should not throw an exception
}
$template = '{{ '.str_repeat('x', 100000).' }}';
$lexer = new Twig_Lexer(new Twig_Environment());
- $stream = $lexer->tokenize($template);
+ $lexer->tokenize($template);
// should not throw an exception
}
$template = '{% '.str_repeat('x', 100000).' %}';
$lexer = new Twig_Lexer(new Twig_Environment());
- $stream = $lexer->tokenize($template);
+ $lexer->tokenize($template);
// should not throw an exception
}
$template = '{{ "bar #{x" }}';
$lexer = new Twig_Lexer(new Twig_Environment());
- $stream = $lexer->tokenize($template);
+ $lexer->tokenize($template);
}
public function testStringWithNestedInterpolations()
';
$lexer = new Twig_Lexer(new Twig_Environment());
- $stream = $lexer->tokenize($template);
+ $lexer->tokenize($template);
}
/**
';
$lexer = new Twig_Lexer(new Twig_Environment());
- $stream = $lexer->tokenize($template);
+ $lexer->tokenize($template);
}
}
public function testCssEscapingEscapesOwaspRecommendedRanges()
{
- $immune = array(); // CSS has no exceptions to escaping ranges
+ // CSS has no exceptions to escaping ranges
for ($chr=0; $chr < 0xFF; $chr++) {
if ($chr >= 0x30 && $chr <= 0x39
|| $chr >= 0x41 && $chr <= 0x5A