mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
add clearCompiledTemplate() tests
This commit is contained in:
@@ -176,4 +176,13 @@ class EvalResourceTest extends PHPUnit_Smarty
|
||||
$tpl = $this->smarty->createTemplate('eval:base64:eyJmb29iYXIifGVzY2FwZX0=');
|
||||
$this->assertEquals('foobar', $tpl->fetch());
|
||||
}
|
||||
|
||||
/**
|
||||
* test clearCompiledTemplate()
|
||||
*/
|
||||
public function testClearCompiled()
|
||||
{
|
||||
$this->assertEquals(0, $this->smarty->clearCompiledTemplate('eval:hello world'));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -20,11 +20,11 @@ class PhpResourceTest extends PHPUnit_Smarty
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
}
|
||||
|
||||
|
||||
public function testInit()
|
||||
{
|
||||
$this->cleanDirs();
|
||||
}
|
||||
|
||||
protected function relative($path)
|
||||
{
|
||||
$path = str_replace(str_replace("\\", "/", dirname(__FILE__)), '.', str_replace("\\", "/", $path));
|
||||
@@ -95,7 +95,8 @@ class PhpResourceTest extends PHPUnit_Smarty
|
||||
$this->smarty->caching = true;
|
||||
$this->smarty->cache_lifetime = 1000;
|
||||
$tpl = $this->smarty->createTemplate('php:phphelloworld.php');
|
||||
$expected = $this->buildCachedPath($tpl, false, null, null, 'phphelloworld.php', 'php', $this->smarty->getTemplateDir(0), 'file');
|
||||
$expected = $this->buildCachedPath($tpl, false, null, null, 'phphelloworld.php', 'php',
|
||||
$this->smarty->getTemplateDir(0), 'file');
|
||||
$this->assertEquals($expected, $tpl->cached->filepath);
|
||||
}
|
||||
|
||||
@@ -263,20 +264,22 @@ class PhpResourceTest extends PHPUnit_Smarty
|
||||
$this->smarty->cache_lifetime = 1000;
|
||||
$tpl = $this->smarty->createTemplate('php:[foo]helloworld.php');
|
||||
$path = $tpl->cached->filepath;
|
||||
$expected = $this->buildCachedPath($tpl, false, null, null, 'helloworld.php', 'php', $this->smarty->getTemplateDir('foo'), 'file');
|
||||
$expected = $this->buildCachedPath($tpl, false, null, null, 'helloworld.php', 'php',
|
||||
$this->smarty->getTemplateDir('foo'), 'file');
|
||||
$this->assertEquals($expected, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* test getRenderedTemplate
|
||||
* test {include} php resource
|
||||
*/
|
||||
public function testIncludePhpTemplate()
|
||||
{
|
||||
$this->smarty->setAllowPhpTemplates(true);
|
||||
$this->assertContains('php hello world', $this->smarty->fetch('includephp.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* test getRenderedTemplate
|
||||
* test {include} php resource caching
|
||||
*/
|
||||
public function testIncludePhpTemplateCaching()
|
||||
{
|
||||
@@ -285,4 +288,13 @@ class PhpResourceTest extends PHPUnit_Smarty
|
||||
$this->assertContains('php hello world', $this->smarty->fetch('includephp.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* test clearCompiledTemplate()
|
||||
*/
|
||||
public function testClearCompiled()
|
||||
{
|
||||
$this->smarty->setAllowPhpTemplates(true);
|
||||
$this->assertEquals(0, $this->smarty->clearCompiledTemplate('php:phphelloworld.php'));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user