3 namespace Doctrine\Tests\Common\Cache;
5 use Doctrine\Common\Cache\MemcacheCache;
9 * @requires extension memcache
11 class MemcacheCacheTest extends CacheTest
15 protected function setUp()
17 $this->memcache = new Memcache();
19 if (@$this->memcache->connect('localhost', 11211) === false) {
20 unset($this->memcache);
21 $this->markTestSkipped('Cannot connect to Memcache.');
25 protected function tearDown()
27 if ($this->memcache instanceof Memcache) {
28 $this->memcache->flush();
35 * Memcache does not support " " and null byte as key so we remove them from the tests.
37 public function provideCacheIds()
39 $ids = parent::provideCacheIds();
40 unset($ids[21], $ids[22]);
45 public function testGetMemcacheReturnsInstanceOfMemcache()
47 $this->assertInstanceOf('Memcache', $this->_getCacheDriver()->getMemcache());
53 protected function _getCacheDriver()
55 $driver = new MemcacheCache();
56 $driver->setMemcache($this->memcache);