Skip to content

Commit

Permalink
Update insert tag tests #496
Browse files Browse the repository at this point in the history
  • Loading branch information
uwetews committed Oct 9, 2018
1 parent 578503c commit adbcf8a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public function dataTestInsert()

/**
* test insert plugin
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testInsertPlugin1()
{
Expand All @@ -97,6 +99,8 @@ public function testInsertPlugin2()

/**
* test insert plugin caching
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testInsertPluginCaching1_1()
{
Expand Down Expand Up @@ -161,6 +165,8 @@ public function testInsertPluginCaching1_4()
}
/**
* test insert plugin caching 2
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testInsertPluginCaching2_1()
{
Expand All @@ -186,12 +192,36 @@ public function testInsertPluginCaching2_2()
$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()
{
Expand All @@ -209,6 +239,8 @@ public function testInsertFunctionNoneExistingFunction()

/**
* test inserted function none existing script
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testInsertFunctionNoneExistingScript()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

function smarty_insert_test2($params, &$smarty) {
return time();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Inner template
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{insert name='test2'}
{include 'inner.tpl'}

0 comments on commit adbcf8a

Please sign in to comment.