From c890cf2b6423772782ac278c2932cc3c87271e5a Mon Sep 17 00:00:00 2001 From: Jannis Grimm Date: Mon, 25 Jul 2011 22:29:47 +0200 Subject: [PATCH] Fixed existing tests --- test/Twig/Tests/Node/ModuleTest.php | 25 ++++++++++++++++--------- test/Twig/Tests/Node/SandboxedModuleTest.php | 11 ++++++++--- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/test/Twig/Tests/Node/ModuleTest.php b/test/Twig/Tests/Node/ModuleTest.php index f928800..0583ef9 100644 --- a/test/Twig/Tests/Node/ModuleTest.php +++ b/test/Twig/Tests/Node/ModuleTest.php @@ -105,11 +105,16 @@ class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template public function getParent(array \$context) { - if (null === \$this->parent) { - \$this->parent = \$this->env->loadTemplate("layout.twig"); + \$parent = "layout.twig"; + if (\$parent instanceof Twig_Template) { + \$name = \$parent->getTemplateName(); + \$this->parent[\$name] = \$parent; + \$parent = \$name; + } elseif (!isset(\$this->parent[\$parent])) { + \$this->parent[\$parent] = \$this->env->loadTemplate(\$parent); } - return \$this->parent; + return \$this->parent[\$parent]; } protected function doDisplay(array \$context, array \$blocks = array()) @@ -152,14 +157,16 @@ class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template public function getParent(array \$context) { - if (null === \$this->parent) { - \$this->parent = ((true) ? ("foo") : ("foo")); - if (!\$this->parent instanceof Twig_Template) { - \$this->parent = \$this->env->loadTemplate(\$this->parent); - } + \$parent = ((true) ? ("foo") : ("foo")); + if (\$parent instanceof Twig_Template) { + \$name = \$parent->getTemplateName(); + \$this->parent[\$name] = \$parent; + \$parent = \$name; + } elseif (!isset(\$this->parent[\$parent])) { + \$this->parent[\$parent] = \$this->env->loadTemplate(\$parent); } - return \$this->parent; + return \$this->parent[\$parent]; } protected function doDisplay(array \$context, array \$blocks = array()) diff --git a/test/Twig/Tests/Node/SandboxedModuleTest.php b/test/Twig/Tests/Node/SandboxedModuleTest.php index 097574e..1a031c3 100644 --- a/test/Twig/Tests/Node/SandboxedModuleTest.php +++ b/test/Twig/Tests/Node/SandboxedModuleTest.php @@ -116,11 +116,16 @@ class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template public function getParent(array \$context) { - if (null === \$this->parent) { - \$this->parent = \$this->env->loadTemplate("layout.twig"); + \$parent = "layout.twig"; + if (\$parent instanceof Twig_Template) { + \$name = \$parent->getTemplateName(); + \$this->parent[\$name] = \$parent; + \$parent = \$name; + } elseif (!isset(\$this->parent[\$parent])) { + \$this->parent[\$parent] = \$this->env->loadTemplate(\$parent); } - return \$this->parent; + return \$this->parent[\$parent]; } protected function doDisplay(array \$context, array \$blocks = array()) -- 1.7.2.5