mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
update unit teste
This commit is contained in:
@@ -52,7 +52,7 @@ class CacheResourceCustomMemcacheTest extends CacheResourceTestCommon
|
||||
$this->smarty->cache_lifetime = 1000;
|
||||
$tpl = $this->smarty->createTemplate('helloworld.tpl');
|
||||
$tpl->loadCached();
|
||||
$sha1 = $tpl->source->uid . '#file:helloworld.tpl###';
|
||||
$sha1 = $tpl->source->uid . '#helloworld_tpl##';
|
||||
$this->assertEquals($sha1, $tpl->cached->filepath);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class CacheResourceCustomMemcacheTest extends CacheResourceTestCommon
|
||||
$this->smarty->cache_lifetime = 1000;
|
||||
$tpl = $this->smarty->createTemplate('helloworld.tpl', 'foo|bar');
|
||||
$tpl->loadCached();
|
||||
$sha1 = $tpl->source->uid . '#file:helloworld.tpl#foo|bar##';
|
||||
$sha1 = $tpl->source->uid . '#helloworld_tpl#foo|bar#';
|
||||
$this->assertEquals($sha1, $tpl->cached->filepath);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ class CacheResourceCustomMemcacheTest extends CacheResourceTestCommon
|
||||
$this->smarty->cache_lifetime = 1000;
|
||||
$tpl = $this->smarty->createTemplate('helloworld.tpl', null, 'blar');
|
||||
$tpl->loadCached();
|
||||
$sha1 = $tpl->source->uid . '#file:helloworld.tpl##blar#';
|
||||
$sha1 = $tpl->source->uid . '#helloworld_tpl##blar';
|
||||
$this->assertEquals($sha1, $tpl->cached->filepath);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ class CacheResourceCustomMemcacheTest extends CacheResourceTestCommon
|
||||
$this->smarty->cache_lifetime = 1000;
|
||||
$tpl = $this->smarty->createTemplate('helloworld.tpl', 'foo|bar', 'blar');
|
||||
$tpl->loadCached();
|
||||
$sha1 = $tpl->source->uid . '#file:helloworld.tpl#foo|bar#blar#';
|
||||
$sha1 = $tpl->source->uid . '#helloworld_tpl#foo|bar#blar';
|
||||
$this->assertEquals($sha1, $tpl->cached->filepath);
|
||||
}
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@
|
||||
* class for demo resource plugin extendsall tests
|
||||
*
|
||||
* @runTestsInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
* @preserveGlobalState disabled
|
||||
* @backupStaticAttributes enabled
|
||||
*/
|
||||
class ResourceExtendsAllPluginTest extends PHPUnit_Smarty
|
||||
@@ -27,6 +27,7 @@ class ResourceExtendsAllPluginTest extends PHPUnit_Smarty
|
||||
|
||||
/**
|
||||
* test extendsall
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
@@ -40,9 +41,10 @@ class ResourceExtendsAllPluginTest extends PHPUnit_Smarty
|
||||
$this->assertEquals($expected, $this->smarty->fetch('extendsall:extendsall.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* test extendsall
|
||||
* changed tepmplate_setting
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
@@ -66,8 +68,10 @@ class ResourceExtendsAllPluginTest extends PHPUnit_Smarty
|
||||
$expected = "templatestemplates";
|
||||
$this->assertEquals($expected, $this->smarty->fetch('extendsall:extendsall2.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* test extendsall special application
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
@@ -76,22 +80,28 @@ class ResourceExtendsAllPluginTest extends PHPUnit_Smarty
|
||||
$this->smarty->addPluginsDir(SMARTY_DIR . "../demo/plugins/");
|
||||
$this->smarty->setTemplateDir(array('./templates_2', './templates_1',));
|
||||
$this->smarty->setDefaultResourceType('extendsall');
|
||||
$this->assertEquals('<p>data1 from templates1</p><p>data1 from templates2</p><p>data2 from templates1</p>', $this->smarty->fetch('template.tpl'));
|
||||
$this->assertEquals('<p>data1 from templates1</p><p>data1 from templates2</p><p>data2 from templates1</p>',
|
||||
$this->smarty->fetch('template.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* test extendsall special application
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testResourcePluginExtendsallSpecialApplication2()
|
||||
{
|
||||
$this->smarty->addPluginsDir(SMARTY_DIR . "../demo/plugins/");
|
||||
$this->smarty->setTemplateDir(array('./templates_3','./templates_2', './templates_1',));
|
||||
$this->smarty->setTemplateDir(array('./templates_3', './templates_2', './templates_1',));
|
||||
$this->smarty->setDefaultResourceType('extendsall');
|
||||
$this->assertEquals('<p>data1 from templates1</p><p>data1 from templates3</p><p>data1 from templates2</p><p>data2 from templates1</p>', $this->smarty->fetch('template.tpl'));
|
||||
$this->assertEquals('<p>data1 from templates1</p><p>data1 from templates3</p><p>data1 from templates2</p><p>data2 from templates1</p>',
|
||||
$this->smarty->fetch('template.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* test extendsall special application
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
@@ -101,10 +111,13 @@ class ResourceExtendsAllPluginTest extends PHPUnit_Smarty
|
||||
$this->smarty->addPluginsDir(SMARTY_DIR . "../demo/plugins/");
|
||||
$this->smarty->setTemplateDir(array('./templates_2', './templates_1',));
|
||||
$this->smarty->setDefaultResourceType('extendsall');
|
||||
$this->assertEquals('<p>data1 from templates1</p><p>data1 from templates2</p><p>data2 from templates1</p>', $this->smarty->fetch('template.tpl'));
|
||||
$this->assertEquals('<p>data1 from templates1</p><p>data1 from templates2</p><p>data2 from templates1</p>',
|
||||
$this->smarty->fetch('template.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* test extendsall special application
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
@@ -114,10 +127,13 @@ class ResourceExtendsAllPluginTest extends PHPUnit_Smarty
|
||||
$this->smarty->addPluginsDir(SMARTY_DIR . "../demo/plugins/");
|
||||
$this->smarty->setTemplateDir(array('./templates_2', './templates_1',));
|
||||
$this->smarty->setDefaultResourceType('extendsall');
|
||||
$this->assertEquals('<p>data1 from templates1</p><p>data1 from templates2</p><p>data2 from templates1</p>', $this->smarty->fetch('template.tpl'));
|
||||
$this->assertEquals('<p>data1 from templates1</p><p>data1 from templates2</p><p>data2 from templates1</p>',
|
||||
$this->smarty->fetch('template.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* test extendsall special application
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
@@ -125,12 +141,15 @@ class ResourceExtendsAllPluginTest extends PHPUnit_Smarty
|
||||
{
|
||||
$this->smarty->setMergeCompiledIncludes(true);
|
||||
$this->smarty->addPluginsDir(SMARTY_DIR . "../demo/plugins/");
|
||||
$this->smarty->setTemplateDir(array('./templates_3','./templates_2', './templates_1',));
|
||||
$this->smarty->setTemplateDir(array('./templates_3', './templates_2', './templates_1',));
|
||||
$this->smarty->setDefaultResourceType('extendsall');
|
||||
$this->assertEquals('<p>data1 from templates1</p><p>data1 from templates3</p><p>data1 from templates2</p><p>data2 from templates1</p>', $this->smarty->fetch('template.tpl'));
|
||||
$this->assertEquals('<p>data1 from templates1</p><p>data1 from templates3</p><p>data1 from templates2</p><p>data2 from templates1</p>',
|
||||
$this->smarty->fetch('template.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* test extendsall special application
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
@@ -138,8 +157,9 @@ class ResourceExtendsAllPluginTest extends PHPUnit_Smarty
|
||||
{
|
||||
$this->smarty->setMergeCompiledIncludes(true);
|
||||
$this->smarty->addPluginsDir(SMARTY_DIR . "../demo/plugins/");
|
||||
$this->smarty->setTemplateDir(array('./templates_3','./templates_2', './templates_1',));
|
||||
$this->smarty->setTemplateDir(array('./templates_3', './templates_2', './templates_1',));
|
||||
$this->smarty->setDefaultResourceType('extendsall');
|
||||
$this->assertEquals('<p>data1 from templates1</p><p>data1 from templates3</p><p>data1 from templates2</p><p>data2 from templates1</p>', $this->smarty->fetch('template.tpl'));
|
||||
$this->assertEquals('<p>data1 from templates1</p><p>data1 from templates3</p><p>data1 from templates2</p><p>data2 from templates1</p>',
|
||||
$this->smarty->fetch('template.tpl'));
|
||||
}
|
||||
}
|
||||
|
@@ -54,7 +54,7 @@ class EvalResourceTest extends PHPUnit_Smarty
|
||||
public function testGetTemplateTimestamp()
|
||||
{
|
||||
$tpl = $this->smarty->createTemplate('eval:hello world');
|
||||
$this->assertFalse($tpl->source->getTimeStamp());
|
||||
$this->assertTrue($tpl->source->getTimeStamp());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -53,7 +53,7 @@ class StreamResourceTest extends PHPUnit_Smarty
|
||||
public function testGetTemplateTimestamp()
|
||||
{
|
||||
$tpl = $this->smarty->createTemplate('global:mytest');
|
||||
$this->assertFalse($tpl->source->getTimeStamp());
|
||||
$this->assertTrue($tpl->source->getTimeStamp());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -65,7 +65,7 @@ class StringResourceTest extends PHPUnit_Smarty
|
||||
public function testGetTemplateTimestamp()
|
||||
{
|
||||
$tpl = $this->smarty->createTemplate('string:hello world');
|
||||
$this->assertEquals(0, $tpl->source->getTimeStamp());
|
||||
$this->assertTrue($tpl->source->getTimeStamp());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user