summaryrefslogtreecommitdiff
path: root/tests/UnitTests/SmartyMethodsTests/CompileCheck/CompileCheckTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/UnitTests/SmartyMethodsTests/CompileCheck/CompileCheckTest.php')
-rw-r--r--tests/UnitTests/SmartyMethodsTests/CompileCheck/CompileCheckTest.php24
1 files changed, 11 insertions, 13 deletions
diff --git a/tests/UnitTests/SmartyMethodsTests/CompileCheck/CompileCheckTest.php b/tests/UnitTests/SmartyMethodsTests/CompileCheck/CompileCheckTest.php
index 2c401b5e..0a55ff4c 100644
--- a/tests/UnitTests/SmartyMethodsTests/CompileCheck/CompileCheckTest.php
+++ b/tests/UnitTests/SmartyMethodsTests/CompileCheck/CompileCheckTest.php
@@ -7,7 +7,6 @@ class CompileCheckTest extends PHPUnit_Smarty
public function setUp(): void
{
$this->setUpSmarty(__DIR__);
- $this->smarty->addTemplateDir('./templates_tmp');
$this->cleanDirs();
}
@@ -16,18 +15,18 @@ class CompileCheckTest extends PHPUnit_Smarty
*/
protected function makeFiles()
{
- file_put_contents('./templates_tmp/t1.tpl', 'TPL1');
- file_put_contents('./templates_tmp/t2.tpl', 'TPL2');
- file_put_contents('./templates_tmp/base.tpl', '{include file="t1.tpl"}{include file="t2.tpl"}');
+ $this->makeTemplateFile('t1.tpl', 'TPL1');
+ $this->makeTemplateFile('t2.tpl', 'TPL2');
+ $this->makeTemplateFile('base.tpl', '{include file="t1.tpl"}{include file="t2.tpl"}');
}
/**
* remove generated templates
*/
protected function removeFiles()
{
- unlink('./templates_tmp/t1.tpl');
- unlink('./templates_tmp/t2.tpl');
- unlink('./templates_tmp/base.tpl');
+ $this->removeTemplateFile('t1.tpl');
+ $this->removeTemplateFile('t2.tpl');
+ $this->removeTemplateFile('base.tpl');
}
/**
@@ -35,8 +34,7 @@ class CompileCheckTest extends PHPUnit_Smarty
* @return void
*/
private function softResetSmarty() {
- $this->smarty = new \Smarty\Smarty();
- $this->smarty->addTemplateDir('./templates_tmp');
+ $this->setUpSmarty(__DIR__);
}
/**
@@ -64,7 +62,7 @@ class CompileCheckTest extends PHPUnit_Smarty
$this->softResetSmarty();
$this->smarty->setCompileCheck(\Smarty\Smarty::COMPILECHECK_ON);
- unlink('./templates_tmp/base.tpl');
+ $this->removeTemplateFile('base.tpl');
sleep(1);
$this->expectException(\Smarty\Exception::class);
@@ -83,7 +81,7 @@ class CompileCheckTest extends PHPUnit_Smarty
$this->smarty->setCompileCheck(\Smarty\Smarty::COMPILECHECK_ON);
sleep(1);
- file_put_contents('./templates_tmp/base.tpl', 'hello');
+ $this->makeTemplateFile('base.tpl', 'hello');
$this->assertEquals('hello', $this->smarty->fetch('base.tpl'));
}
@@ -113,7 +111,7 @@ class CompileCheckTest extends PHPUnit_Smarty
$this->softResetSmarty();
$this->smarty->setCompileCheck(\Smarty\Smarty::COMPILECHECK_OFF);
- unlink('./templates_tmp/base.tpl');
+ $this->removeTemplateFile('base.tpl');
sleep(1);
$this->assertEquals('TPL1TPL2', $this->smarty->fetch('base.tpl'));
@@ -131,7 +129,7 @@ class CompileCheckTest extends PHPUnit_Smarty
$this->smarty->setCompileCheck(\Smarty\Smarty::COMPILECHECK_OFF);
sleep(1);
- file_put_contents('./templates_tmp/base.tpl', 'hello');
+ $this->makeTemplateFile('base.tpl', 'hello');
$this->assertEquals('TPL1TPL2', $this->smarty->fetch('base.tpl'));
}