在setUp()方法中检测扩展

This commit is contained in:
7IN0SAN9
2016-01-29 16:31:15 +08:00
parent 5734635706
commit 7f1a1cae65
3 changed files with 11 additions and 11 deletions

View File

@@ -24,6 +24,11 @@ class apcTest extends cacheTestCase
*/
protected function setUp()
{
if (!extension_loaded("apc")) {
$this->markTestSkipped("APC没有安装已跳过测试");
} elseif ('cli' === PHP_SAPI && !ini_get('apc.enable_cli')) {
$this->markTestSkipped("APC模块没有开启已跳过测试");
}
\think\Cache::connect(array('type' => 'apc', 'expire' => 2));
}
/**
@@ -31,11 +36,6 @@ class apcTest extends cacheTestCase
*/
protected function getCacheInstance()
{
if (!extension_loaded("apc")) {
$this->markTestSkipped("APC没有安装已跳过测试");
} elseif ('cli' === PHP_SAPI && !ini_get('apc.enable_cli')) {
$this->markTestSkipped("APC模块没有开启已跳过测试");
}
if (null === $this->_cacheInstance) {
$this->_cacheInstance = new \think\cache\driver\Apc();
}