MemCachedTest.php 547 Bytes
Newer Older
1 2 3 4 5
<?php
namespace yiiunit\framework\caching;
use yii\caching\MemCache;

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

	/**
	 * @return MemCache
	 */
	protected function getCacheInstance()
	{
resurtm committed
17
		if (!extension_loaded("memcached")) {
18 19 20
			$this->markTestSkipped("memcached not installed. Skipping.");
		}

resurtm committed
21
		if ($this->_cacheInstance === null) {
22 23 24 25 26 27
			$this->_cacheInstance = new MemCache(array(
				'useMemcached' => true,
			));
		}
		return $this->_cacheInstance;
	}
Zander Baldwin committed
28
}