ApcCacheTest.php 861 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<?php
namespace yiiunit\framework\caching;
use yii\caching\ApcCache;
use yiiunit\TestCase;

/**
 * Class for testing APC cache backend
 */
class ApcCacheTest extends CacheTest
{
	private $_cacheInstance = null;

	/**
	 * @return ApcCache
	 */
	protected function getCacheInstance()
	{
		if(!extension_loaded("apc")) {
			$this->markTestSkipped("APC not installed. Skipping.");
		}

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

26 27 28 29 30
		if($this->_cacheInstance === null) {
			$this->_cacheInstance = new ApcCache();
		}
		return $this->_cacheInstance;
	}
31 32 33 34

	// TODO there seems to be a problem with APC returning cached value even if it is expired.
	// TODO makes test fail on PHP 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli) -- cebe
	// TODO http://drupal.org/node/1278292
35
}