Commit 173da605 by Jordi Boggiano

Fixed regression in 07e1dd

parent 39d9ca00
......@@ -29,6 +29,9 @@ class Dwoo_Plugin_dynamic extends Dwoo_Block_Plugin implements Dwoo_ICompilable_
{
try {
$compiler->findBlock('dynamic');
return $content;
} catch (Dwoo_Compilation_Exception $e) {
}
$output = Dwoo_Compiler::PHP_OPEN .
'if($doCache) {'."\n\t".
'echo \'<dwoo:dynamic_\'.$dynamicId.\'>'.
......@@ -48,9 +51,6 @@ class Dwoo_Plugin_dynamic extends Dwoo_Block_Plugin implements Dwoo_ICompilable_
$output .= "\n}". Dwoo_Compiler::PHP_CLOSE;
return $output;
} catch (Dwoo_Compilation_Exception $e) {
return $content;
}
}
public static function unescape($output, $dynamicId, $compiledFile)
......
......@@ -103,14 +103,31 @@ BAZZ {/capture}{$foo}');
public function testDynamic()
{
$preTime = time();
$tpl = new Dwoo_Template_String('{$pre}{dynamic}{$pre}{/}', 10, 'testDynamic');
$tpl = new Dwoo_Template_String('t{$pre}{dynamic}{$pre}{/}', 10, 'testDynamic');
$tpl->forceCompilation();
$this->assertEquals($preTime . $preTime, $this->dwoo->get($tpl, array('pre'=>$preTime), $this->compiler));
$this->assertEquals('t'.$preTime . $preTime, $this->dwoo->get($tpl, array('pre'=>$preTime), $this->compiler));
sleep(1);
$postTime = time();
$this->assertEquals($preTime . $postTime, $this->dwoo->get($tpl, array('pre'=>$postTime), $this->compiler));
$this->assertEquals('t'.$preTime . $postTime, $this->dwoo->get($tpl, array('pre'=>$postTime), $this->compiler));
// fixes the init call not being called (which is normal)
$fixCall = new Dwoo_Plugin_dynamic($this->dwoo);
$fixCall->init('');
}
public function testDynamicNested()
{
$preTime = time();
$tpl = new Dwoo_Template_String('t{$pre}{dynamic}{$pre}{dynamic}{$pre}{/}{/}', 10, 'testDynamicNested');
$tpl->forceCompilation();
$this->assertEquals('t'.$preTime . $preTime . $preTime, $this->dwoo->get($tpl, array('pre'=>$preTime), $this->compiler));
sleep(1);
$postTime = time();
$this->assertEquals('t'.$preTime . $postTime . $postTime, $this->dwoo->get($tpl, array('pre'=>$postTime), $this->compiler));
// fixes the init call not being called (which is normal)
$fixCall = new Dwoo_Plugin_dynamic($this->dwoo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment