update configuration of disabled resource tests

This commit is contained in:
uwetews
2015-12-30 21:14:22 +01:00
parent 1800432c4c
commit b887f18acf
8 changed files with 190 additions and 175 deletions

View File

@@ -6,6 +6,7 @@
/* /*
* Smarty PHPUnit Bootstrap * Smarty PHPUnit Bootstrap
*/ */
include_once __DIR__ . '/Config.php';
// Locate Autoloader or SmartyBC class and load it // Locate Autoloader or SmartyBC class and load it
if (is_file(__DIR__ . '/../smarty/libs/Autoloader.php')) { if (is_file(__DIR__ . '/../smarty/libs/Autoloader.php')) {
require_once __DIR__ . '/../smarty/libs/Autoloader.php'; require_once __DIR__ . '/../smarty/libs/Autoloader.php';

View File

@@ -4,8 +4,6 @@
* *
*/ */
include_once __DIR__ . '/Config.php';
/** /**
* Smarty Test Case Fixture * Smarty Test Case Fixture
*/ */
@@ -106,7 +104,7 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase
define('individualFolders', true); define('individualFolders', true);
} }
parent::__construct($name, $data, $dataName); parent::__construct($name, $data, $dataName);
$this->backupStaticAttributesBlacklist[get_class($this)] = array('init', 'config', 'pdo'); $this->backupStaticAttributesBlacklist[ get_class($this) ] = array('init', 'config', 'pdo');
} }
/** /**
@@ -129,10 +127,10 @@ class PHPUnit_Smarty extends PHPUnit_Framework_TestCase
mkdir($dir . '/configs'); mkdir($dir . '/configs');
} }
if (individualFolders != 'true') { if (individualFolders != 'true') {
if (!isset($s_dir[$dir])) { if (!isset($s_dir[ $dir ])) {
$this->cleanDir($dir . '/templates_c'); $this->cleanDir($dir . '/templates_c');
$this->cleanDir($dir . '/cache'); $this->cleanDir($dir . '/cache');
$s_dir[$dir] = true; $s_dir[ $dir ] = true;
} }
$dir = __DIR__; $dir = __DIR__;
} }
@@ -351,7 +349,8 @@ KEY `expire` (`expire`)
case 'file': case 'file':
case 'filetest': case 'filetest':
if ($tpl instanceof Smarty) { if ($tpl instanceof Smarty) {
return sha1($this->normalizePath($this->smarty->getTemplateDir(0) . $name) . $this->smarty->_joined_template_dir); return sha1($this->normalizePath($this->smarty->getTemplateDir(0) . $name) .
$this->smarty->_joined_template_dir);
} }
return sha1($tpl->source->filepath . $this->smarty->_joined_template_dir); return sha1($tpl->source->filepath . $this->smarty->_joined_template_dir);
case 'mysqltest': case 'mysqltest':
@@ -375,7 +374,7 @@ KEY `expire` (`expire`)
*/ */
public function normalizePath($path) public function normalizePath($path)
{ {
if ($path[0] == '.') { if ($path[ 0 ] == '.') {
$path = getcwd() . DS . $path; $path = getcwd() . DS . $path;
} }
$path = preg_replace('#[\\\/]+([.][\\\/]+)*#', DS, $path); $path = preg_replace('#[\\\/]+([.][\\\/]+)*#', DS, $path);
@@ -539,8 +538,8 @@ KEY `expire` (`expire`)
$uid = $this->buildUid($tpl, $sp, $name, $type); $uid = $this->buildUid($tpl, $sp, $name, $type);
$_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null; $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
$_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null; $_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null;
return sha1($uid) . '#' . preg_replace('#[^\w\|]+#S', '_', $tpl->template_resource) . '#' . return sha1($uid) . '#' . preg_replace('#[^\w\|]+#S', '_', $tpl->template_resource) . '#' . $_cache_id .
$_cache_id . '#' . $_compile_id; '#' . $_compile_id;
default: default:
throw new Exception("Unhandled cache resource type '{$cacheType}'"); throw new Exception("Unhandled cache resource type '{$cacheType}'");

View File

@@ -5,18 +5,18 @@
* @package PHPunit * @package PHPunit
* @author Uwe Tews * @author Uwe Tews
*/ */
if (ApcCacheEnable == true) {
include_once __DIR__ . '/../Memcache/CacheResourceCustomMemcacheTest.php';
include_once __DIR__ . '/../Memcache/CacheResourceCustomMemcacheTest.php'; /**
/**
* class for cache resource file tests * class for cache resource file tests
* *
* @runTestsInSeparateProcess * @runTestsInSeparateProcess
* @preserveGlobalState disabled * @preserveGlobalState disabled
* @backupStaticAttributes enabled * @backupStaticAttributes enabled
*/ */
class CacheResourceCustomApcTest extends CacheResourceCustomMemcacheTest class CacheResourceCustomApcTest extends CacheResourceCustomMemcacheTest
{ {
public function setUp() public function setUp()
{ {
if (ApcCacheEnable != true) { if (ApcCacheEnable != true) {
@@ -31,5 +31,6 @@ class CacheResourceCustomApcTest extends CacheResourceCustomMemcacheTest
$this->smarty->setCachingType('apc'); $this->smarty->setCachingType('apc');
$this->smarty->addPluginsDir(SMARTY_DIR . '../demo/plugins/'); $this->smarty->addPluginsDir(SMARTY_DIR . '../demo/plugins/');
} }
}
} }

View File

@@ -5,18 +5,19 @@
* @package PHPunit * @package PHPunit
* @author Uwe Tews * @author Uwe Tews
*/ */
if (MemCacheEnable == true) {
include_once __DIR__ . '/../_shared/CacheResourceTestCommon.php'; include_once __DIR__ . '/../_shared/CacheResourceTestCommon.php';
/** /**
* class for cache resource memcache tests * class for cache resource memcache tests
* *
* @runTestsInSeparateProcess * @runTestsInSeparateProcess
* @preserveGlobalState disabled * @preserveGlobalState disabled
* @backupStaticAttributes enabled * @backupStaticAttributes enabled
*/ */
class CacheResourceCustomMemcacheTest extends CacheResourceTestCommon class CacheResourceCustomMemcacheTest extends CacheResourceTestCommon
{ {
/** /**
* Sets up the fixture * Sets up the fixture
* This method is called before a test is executed. * This method is called before a test is executed.
@@ -45,4 +46,5 @@ class CacheResourceCustomMemcacheTest extends CacheResourceTestCommon
{ {
$this->assertEquals(- 1, $b); $this->assertEquals(- 1, $b);
} }
}
} }

View File

@@ -5,18 +5,19 @@
* @package PHPunit * @package PHPunit
* @author Uwe Tews * @author Uwe Tews
*/ */
if (MysqlCacheEnable == true) {
include_once __DIR__ . '/../_shared/CacheResourceTestCommon.php'; include_once __DIR__ . '/../_shared/CacheResourceTestCommon.php';
/** /**
* class for cache resource file tests * class for cache resource file tests
* *
* @runTestsInSeparateProcess * @runTestsInSeparateProcess
* @preserveGlobalState disabled * @preserveGlobalState disabled
* @backupStaticAttributes enabled * @backupStaticAttributes enabled
*/ */
class CacheResourceCustomMysqlTest extends CacheResourceTestCommon class CacheResourceCustomMysqlTest extends CacheResourceTestCommon
{ {
public function setUp() public function setUp()
{ {
@@ -36,5 +37,6 @@ class CacheResourceCustomMysqlTest extends CacheResourceTestCommon
$this->cleanDirs(); $this->cleanDirs();
$this->initMysqlCache(); $this->initMysqlCache();
} }
}
} }

View File

@@ -5,18 +5,19 @@
* @package PHPunit * @package PHPunit
* @author Uwe Tews * @author Uwe Tews
*/ */
if (PdoCacheEnable == true) {
include_once __DIR__ . '/../_shared/CacheResourceTestCommon.php'; include_once __DIR__ . '/../_shared/CacheResourceTestCommon.php';
/** /**
* class for cache resource file tests * class for cache resource file tests
* *
* @runTestsInSeparateProcess * @runTestsInSeparateProcess
* @preserveGlobalState disabled * @preserveGlobalState disabled
* @backupStaticAttributes enabled * @backupStaticAttributes enabled
*/ */
class CacheResourceCustomPDOTest extends CacheResourceTestCommon class CacheResourceCustomPDOTest extends CacheResourceTestCommon
{ {
public function setUp($dir = null, $clear = true) public function setUp($dir = null, $clear = true)
{ {
@@ -30,8 +31,10 @@ class CacheResourceCustomPDOTest extends CacheResourceTestCommon
parent::setUp(); parent::setUp();
$this->smarty->setCachingType('pdo'); $this->smarty->setCachingType('pdo');
$this->smarty->addPluginsDir(SMARTY_DIR . '../demo/plugins/'); $this->smarty->addPluginsDir(SMARTY_DIR . '../demo/plugins/');
$this->assertTrue(false !== $this->smarty->loadPlugin('Smarty_CacheResource_Pdotest'), 'loadPlugin() could not load PDO cache resource'); $this->assertTrue(false !== $this->smarty->loadPlugin('Smarty_CacheResource_Pdotest'),
$this->smarty->registerCacheResource('pdo', new Smarty_CacheResource_Pdotest($this->getPDO(), 'output_cache')); 'loadPlugin() could not load PDO cache resource');
$this->smarty->registerCacheResource('pdo',
new Smarty_CacheResource_Pdotest($this->getPDO(), 'output_cache'));
} }
public function testInit() public function testInit()
@@ -39,5 +42,6 @@ class CacheResourceCustomPDOTest extends CacheResourceTestCommon
$this->cleanDirs(); $this->cleanDirs();
$this->initMysqlCache(); $this->initMysqlCache();
} }
}
} }

View File

@@ -5,16 +5,17 @@
* @package PHPunit * @package PHPunit
* @author Uwe Tews * @author Uwe Tews
*/ */
if (PdoGzipCacheEnable == true) {
include_once __DIR__ . '/../_shared/CacheResourceTestCommon.php'; include_once __DIR__ . '/../_shared/CacheResourceTestCommon.php';
/** /**
* class for cache resource file tests * class for cache resource file tests
* *
* @backupStaticAttributes enabled * @backupStaticAttributes enabled
*/ */
class CacheResourceCustomPDOGzipTest extends CacheResourceTestCommon class CacheResourceCustomPDOGzipTest extends CacheResourceTestCommon
{ {
public function setUp($dir = null, $clear = true) public function setUp($dir = null, $clear = true)
{ {
@@ -28,8 +29,10 @@ class CacheResourceCustomPDOGzipTest extends CacheResourceTestCommon
parent::setUp(); parent::setUp();
$this->smarty->setCachingType('pdo'); $this->smarty->setCachingType('pdo');
$this->smarty->addPluginsDir(SMARTY_DIR . '../demo/plugins/'); $this->smarty->addPluginsDir(SMARTY_DIR . '../demo/plugins/');
$this->assertTrue(false !== $this->smarty->loadPlugin('Smarty_CacheResource_Pdo_Gziptest'), 'loadPlugin() could not load PDOGzip cache resource'); $this->assertTrue(false !== $this->smarty->loadPlugin('Smarty_CacheResource_Pdo_Gziptest'),
$this->smarty->registerCacheResource('pdo', new Smarty_CacheResource_Pdo_Gziptest($this->getPDO(), 'output_cache')); 'loadPlugin() could not load PDOGzip cache resource');
$this->smarty->registerCacheResource('pdo', new Smarty_CacheResource_Pdo_Gziptest($this->getPDO(),
'output_cache'));
} }
public function testInit() public function testInit()
@@ -37,5 +40,6 @@ class CacheResourceCustomPDOGzipTest extends CacheResourceTestCommon
$this->cleanDirs(); $this->cleanDirs();
$this->initMysqlCache(); $this->initMysqlCache();
} }
}
} }

View File

@@ -5,17 +5,18 @@
* @package PHPunit * @package PHPunit
* @author Uwe Tews * @author Uwe Tews
*/ */
include_once __DIR__ . '/../_shared/CacheResourceTestCommon.php'; if (MysqlCacheEnable == true) {
include_once __DIR__ . '/../_shared/CacheResourceTestCommon.php';
/** /**
* class for cache resource file tests * class for cache resource file tests
* *
* @runTestsInSeparateProcess * @runTestsInSeparateProcess
* @preserveGlobalState disabled * @preserveGlobalState disabled
* @backupStaticAttributes enabled * @backupStaticAttributes enabled
*/ */
class CacheResourceCustomRegisteredTest extends CacheResourceTestCommon class CacheResourceCustomRegisteredTest extends CacheResourceTestCommon
{ {
public function setUp() public function setUp()
{ {
if (MysqlCacheEnable != true) { if (MysqlCacheEnable != true) {
@@ -38,5 +39,6 @@ class CacheResourceCustomRegisteredTest extends CacheResourceTestCommon
$this->cleanDirs(); $this->cleanDirs();
$this->initMysqlCache(); $this->initMysqlCache();
} }
}
} }