ApcCacheTest.php 872 Bytes
Newer Older
1 2 3 4 5 6 7
<?php
namespace yiiunit\framework\caching;
use yii\caching\ApcCache;

/**
 * Class for testing APC cache backend
 */
Alexander Makarov committed
8
class ApcCacheTest extends CacheTestCase
9 10 11 12 13 14 15 16
{
	private $_cacheInstance = null;

	/**
	 * @return ApcCache
	 */
	protected function getCacheInstance()
	{
Alexander Kochetov committed
17
		if (!extension_loaded("apc")) {
18
			$this->markTestSkipped("APC not installed. Skipping.");
Alexander Kochetov committed
19
		} elseif ('cli' === PHP_SAPI && !ini_get('apc.enable_cli')) {
20
			$this->markTestSkipped("APC cli is not enabled. Skipping.");
21 22
		}

23 24 25 26
		if(!ini_get("apc.enabled") || !ini_get("apc.enable_cli")) {
			$this->markTestSkipped("APC is installed but not enabled. Skipping.");
		}

Alexander Kochetov committed
27
		if ($this->_cacheInstance === null) {
28 29 30 31
			$this->_cacheInstance = new ApcCache();
		}
		return $this->_cacheInstance;
	}
32

33 34 35 36
	public function testExpire()
	{
		$this->markTestSkipped("APC keys are expiring only on the next request.");
	}
Zander Baldwin committed
37
}