Definition at line 11 of file OptimizerTest.php.
◆ checkForConfiguration()
Twig_Tests_NodeVisitor_OptimizerTest::checkForConfiguration |
( |
Twig_NodeInterface |
$node = null , |
|
|
|
$target, |
|
|
|
$withLoop |
|
) |
| |
Definition at line 105 of file OptimizerTest.php.
References $n, $ret, and $target.
Referenced by testForOptimizer().
107 if (null === $node) {
111 foreach ($node as
$n) {
113 if (
$target === $n->getNode(
'value_target')->getAttribute(
'name')) {
114 return $withLoop == $n->getAttribute(
'with_loop');
checkForConfiguration(Twig_NodeInterface $node=null, $target, $withLoop)
◆ getTestsForForOptimizer()
Twig_Tests_NodeVisitor_OptimizerTest::getTestsForForOptimizer |
( |
| ) |
|
Definition at line 66 of file OptimizerTest.php.
References array.
69 array(
'{% for i in foo %}{% endfor %}',
array(
'i' =>
false)),
71 array(
'{% for i in foo %}{{ loop.index }}{% endfor %}',
array(
'i' =>
true)),
73 array(
'{% for i in foo %}{% for j in foo %}{% endfor %}{% endfor %}',
array(
'i' =>
false,
'j' =>
false)),
75 array(
'{% for i in foo %}{% include "foo" %}{% endfor %}',
array(
'i' =>
true)),
77 array(
'{% for i in foo %}{% include "foo" only %}{% endfor %}',
array(
'i' =>
false)),
79 array(
'{% for i in foo %}{% include "foo" with { "foo": "bar" } only %}{% endfor %}',
array(
'i' =>
false)),
81 array(
'{% for i in foo %}{% include "foo" with { "foo": loop.index } only %}{% endfor %}',
array(
'i' =>
true)),
83 array(
'{% for i in foo %}{% for j in foo %}{{ loop.index }}{% endfor %}{% endfor %}',
array(
'i' =>
false,
'j' =>
true)),
85 array(
'{% for i in foo %}{% for j in foo %}{{ loop.parent.loop.index }}{% endfor %}{% endfor %}',
array(
'i' =>
true,
'j' =>
true)),
87 array(
'{% for i in foo %}{% set l = loop %}{% for j in foo %}{{ l.index }}{% endfor %}{% endfor %}',
array(
'i' =>
true,
'j' =>
false)),
89 array(
'{% for i in foo %}{% for j in foo %}{{ foo.parent.loop.index }}{% endfor %}{% endfor %}',
array(
'i' =>
false,
'j' =>
false)),
91 array(
'{% for i in foo %}{% for j in foo %}{{ loop["parent"].loop.index }}{% endfor %}{% endfor %}',
array(
'i' =>
true,
'j' =>
true)),
93 array(
'{% for i in foo %}{{ include("foo") }}{% endfor %}',
array(
'i' =>
true)),
95 array(
'{% for i in foo %}{{ include("foo", with_context = false) }}{% endfor %}',
array(
'i' =>
false)),
97 array(
'{% for i in foo %}{{ include("foo", with_context = true) }}{% endfor %}',
array(
'i' =>
true)),
99 array(
'{% for i in foo %}{{ include("foo", { "foo": "bar" }, with_context = false) }}{% endfor %}',
array(
'i' =>
false)),
101 array(
'{% for i in foo %}{{ include("foo", { "foo": loop.index }, with_context = false) }}{% endfor %}',
array(
'i' =>
true)),
Create styles array
The data for the language used.
◆ testForOptimizer()
Twig_Tests_NodeVisitor_OptimizerTest::testForOptimizer |
( |
|
$template, |
|
|
|
$expected |
|
) |
| |
◆ testRenderBlockOptimizer()
Twig_Tests_NodeVisitor_OptimizerTest::testRenderBlockOptimizer |
( |
| ) |
|
Definition at line 13 of file OptimizerTest.php.
References $env, GuzzleHttp\Psr7\$stream, and array.
15 $env =
new Twig_Environment($this->getMockBuilder(
'Twig_LoaderInterface')->getMock(),
array(
'cache' =>
false,
'autoescape' =>
false));
19 $node =
$stream->getNode(
'body')->getNode(0);
21 $this->assertEquals(
'Twig_Node_Expression_BlockReference', get_class($node));
22 $this->assertTrue($node->getAttribute(
'output'));
$stream
PHP stream implementation.
Create styles array
The data for the language used.
Holds information about a non-compiled Twig template.
Stores the Twig configuration.
◆ testRenderParentBlockOptimizer()
Twig_Tests_NodeVisitor_OptimizerTest::testRenderParentBlockOptimizer |
( |
| ) |
|
Definition at line 25 of file OptimizerTest.php.
References $env, GuzzleHttp\Psr7\$stream, and array.
27 $env =
new Twig_Environment($this->getMockBuilder(
'Twig_LoaderInterface')->getMock(),
array(
'cache' =>
false,
'autoescape' =>
false));
29 $stream =
$env->parse(
$env->tokenize(
new Twig_Source(
'{% extends "foo" %}{% block content %}{{ parent() }}{% endblock %}',
'index')));
31 $node =
$stream->getNode(
'blocks')->getNode(
'content')->getNode(0)->getNode(
'body');
33 $this->assertEquals(
'Twig_Node_Expression_Parent', get_class($node));
34 $this->assertTrue($node->getAttribute(
'output'));
$stream
PHP stream implementation.
Create styles array
The data for the language used.
Holds information about a non-compiled Twig template.
Stores the Twig configuration.
◆ testRenderVariableBlockOptimizer()
Twig_Tests_NodeVisitor_OptimizerTest::testRenderVariableBlockOptimizer |
( |
| ) |
|
Definition at line 37 of file OptimizerTest.php.
References $env, GuzzleHttp\Psr7\$stream, and array.
39 if (PHP_VERSION_ID >= 50400) {
40 $this->markTestSkipped(
'not needed on PHP >= 5.4');
43 $env =
new Twig_Environment($this->getMockBuilder(
'Twig_LoaderInterface')->getMock(),
array(
'cache' =>
false,
'autoescape' =>
false));
46 $node =
$stream->getNode(
'body')->getNode(0)->getNode(1);
48 $this->assertEquals(
'Twig_Node_Expression_BlockReference', get_class($node));
49 $this->assertTrue($node->getAttribute(
'output'));
$stream
PHP stream implementation.
Create styles array
The data for the language used.
Holds information about a non-compiled Twig template.
Stores the Twig configuration.
The documentation for this class was generated from the following file: