mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 18:04:26 +02:00
Update insert tag tests https://github.com/smarty-php/smarty/issues/496
This commit is contained in:
@@ -72,6 +72,8 @@ class CompileInsertTest extends PHPUnit_Smarty
|
||||
|
||||
/**
|
||||
* test insert plugin
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testInsertPlugin1()
|
||||
{
|
||||
@@ -97,6 +99,8 @@ class CompileInsertTest extends PHPUnit_Smarty
|
||||
|
||||
/**
|
||||
* test insert plugin caching
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testInsertPluginCaching1_1()
|
||||
{
|
||||
@@ -161,6 +165,8 @@ class CompileInsertTest extends PHPUnit_Smarty
|
||||
}
|
||||
/**
|
||||
* test insert plugin caching 2
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testInsertPluginCaching2_1()
|
||||
{
|
||||
@@ -186,12 +192,36 @@ class CompileInsertTest extends PHPUnit_Smarty
|
||||
$this->smarty->compile_id = 1;
|
||||
$tpl = $this->smarty->createTemplate('insertplugintest.tpl');
|
||||
$tpl->assign('foo', 'buh');
|
||||
$this->assertEquals('param foo bar globalvar global 2', $this->smarty->fetch($tpl));
|
||||
$this->assertContains('param foo bar globalvar global 2', $this->smarty->fetch($tpl));
|
||||
}
|
||||
/**
|
||||
* test insert plugin caching 3
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testInsertPluginCaching3_1()
|
||||
{
|
||||
$this->smarty->caching = true;
|
||||
$this->assertContains(time().'Inner template', $this->smarty->fetch('insertplugintest2.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* test insert plugin caching 2
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testInsertPluginCaching3_2()
|
||||
{
|
||||
sleep(2);
|
||||
$this->smarty->caching = true;
|
||||
$this->assertContains(time().'Inner template', $this->smarty->fetch('insertplugintest2.tpl'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* test inserted function none existing function
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testInsertFunctionNoneExistingFunction()
|
||||
{
|
||||
@@ -209,6 +239,8 @@ class CompileInsertTest extends PHPUnit_Smarty
|
||||
|
||||
/**
|
||||
* test inserted function none existing script
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testInsertFunctionNoneExistingScript()
|
||||
{
|
||||
|
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
function smarty_insert_test2($params, &$smarty) {
|
||||
return time();
|
||||
}
|
@@ -0,0 +1 @@
|
||||
Inner template
|
@@ -0,0 +1,2 @@
|
||||
{insert name='test2'}
|
||||
{include 'inner.tpl'}
|
Reference in New Issue
Block a user