2009-07-15 02:36:09 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\Common\Cache;
|
|
|
|
|
|
|
|
use Doctrine\Common\Cache\MemcacheCache;
|
|
|
|
|
|
|
|
require_once __DIR__ . '/../../TestInit.php';
|
|
|
|
|
2010-01-29 04:38:37 +03:00
|
|
|
class MemcacheCacheTest extends CacheTest
|
2009-07-15 02:36:09 +04:00
|
|
|
{
|
2009-11-08 14:07:49 +03:00
|
|
|
private $_memcache;
|
2010-01-29 04:38:37 +03:00
|
|
|
|
2009-07-15 02:36:09 +04:00
|
|
|
public function setUp()
|
|
|
|
{
|
2009-11-08 14:07:49 +03:00
|
|
|
if (extension_loaded('memcache')) {
|
2009-12-11 00:27:20 +03:00
|
|
|
$this->_memcache = new \Memcache;
|
|
|
|
$ok = @$this->_memcache->connect('localhost', 11211);
|
2009-11-08 14:07:49 +03:00
|
|
|
if (!$ok) {
|
|
|
|
$this->markTestSkipped('The ' . __CLASS__ .' requires the use of memcache');
|
|
|
|
}
|
|
|
|
} else {
|
2009-07-15 02:36:09 +04:00
|
|
|
$this->markTestSkipped('The ' . __CLASS__ .' requires the use of memcache');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-29 04:38:37 +03:00
|
|
|
protected function _getCacheDriver()
|
2009-07-15 02:36:09 +04:00
|
|
|
{
|
2010-01-29 04:38:37 +03:00
|
|
|
$driver = new MemcacheCache();
|
|
|
|
$driver->setMemcache($this->_memcache);
|
|
|
|
return $driver;
|
2009-07-15 02:36:09 +04:00
|
|
|
}
|
|
|
|
}
|