mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
enable memcache amd msql
This commit is contained in:
@@ -7,12 +7,12 @@
|
||||
* Smarty PHPUnit Config
|
||||
*/
|
||||
define('individualFolders', true);
|
||||
define('MemCacheEnable', false);
|
||||
define('MemCacheEnable', true);
|
||||
define('ApcCacheEnable', false);
|
||||
define('MysqlCacheEnable', false);
|
||||
define('MysqlCacheEnable', true);
|
||||
define('PdoCacheEnable', false);
|
||||
define('PdoGzipCacheEnable', false);
|
||||
define('MysqlResourceEnable', false);
|
||||
define('MysqlResourceEnable', true);
|
||||
define('DB_DSN', "mysql:dbname=test;host=localhost");
|
||||
define('DB_USER', "travis");
|
||||
define('DB_USER', "smarty");
|
||||
define('DB_PASSWD', "");
|
||||
|
@@ -5,9 +5,8 @@
|
||||
* @package PHPunit
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
if (MemCacheEnable == true) {
|
||||
|
||||
include_once dirname(__FILE__) . '/../_shared/CacheResourceTestCommon.php';
|
||||
include_once __DIR__ . '/../_shared/CacheResourceTestCommon.php';
|
||||
|
||||
/**
|
||||
* class for cache resource memcache tests
|
||||
@@ -32,7 +31,7 @@ if (MemCacheEnable == true) {
|
||||
$this->markTestSkipped('Memcache not available');
|
||||
}
|
||||
}
|
||||
$this->setUpSmarty(dirname(__FILE__));
|
||||
$this->setUpSmarty(__DIR__);
|
||||
parent::setUp();
|
||||
$this->smarty->setCachingType('memcachetest');
|
||||
}
|
||||
@@ -46,5 +45,53 @@ if (MemCacheEnable == true) {
|
||||
{
|
||||
$this->assertEquals(- 1, $b);
|
||||
}
|
||||
|
||||
public function testGetCachedFilepathSubDirs()
|
||||
{
|
||||
$this->smarty->caching = true;
|
||||
$this->smarty->cache_lifetime = 1000;
|
||||
$tpl = $this->smarty->createTemplate('helloworld.tpl');
|
||||
$tpl->loadCached();
|
||||
$sha1 = $tpl->source->uid . '#file:helloworld.tpl###';
|
||||
$this->assertEquals($sha1, $tpl->cached->filepath);
|
||||
}
|
||||
|
||||
/**
|
||||
* test getCachedFilepath with cache_id
|
||||
*/
|
||||
public function testGetCachedFilepathCacheId()
|
||||
{
|
||||
$this->smarty->caching = true;
|
||||
$this->smarty->cache_lifetime = 1000;
|
||||
$tpl = $this->smarty->createTemplate('helloworld.tpl', 'foo|bar');
|
||||
$tpl->loadCached();
|
||||
$sha1 = $tpl->source->uid . '#file:helloworld.tpl#foo|bar##';
|
||||
$this->assertEquals($sha1, $tpl->cached->filepath);
|
||||
}
|
||||
|
||||
/**
|
||||
* test getCachedFilepath with compile_id
|
||||
*/
|
||||
public function testGetCachedFilepathCompileId()
|
||||
{
|
||||
$this->smarty->caching = true;
|
||||
$this->smarty->cache_lifetime = 1000;
|
||||
$tpl = $this->smarty->createTemplate('helloworld.tpl', null, 'blar');
|
||||
$tpl->loadCached();
|
||||
$sha1 = $tpl->source->uid . '#file:helloworld.tpl##blar#';
|
||||
$this->assertEquals($sha1, $tpl->cached->filepath);
|
||||
}
|
||||
|
||||
/**
|
||||
* test getCachedFilepath with cache_id and compile_id
|
||||
*/
|
||||
public function testGetCachedFilepathCacheIdCompileId()
|
||||
{
|
||||
$this->smarty->caching = true;
|
||||
$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#';
|
||||
$this->assertEquals($sha1, $tpl->cached->filepath);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user