MemcacheCacheTest.php 767B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Doctrine\Tests\Common\Cache;
  3. use Doctrine\Common\Cache\MemcacheCache;
  4. class MemcacheCacheTest extends CacheTest
  5. {
  6. private $_memcache;
  7. public function setUp()
  8. {
  9. if (extension_loaded('memcache')) {
  10. $this->_memcache = new \Memcache;
  11. $ok = @$this->_memcache->connect('localhost', 11211);
  12. if (!$ok) {
  13. $this->markTestSkipped('The ' . __CLASS__ .' requires the use of memcache');
  14. }
  15. } else {
  16. $this->markTestSkipped('The ' . __CLASS__ .' requires the use of memcache');
  17. }
  18. }
  19. protected function _getCacheDriver()
  20. {
  21. $driver = new MemcacheCache();
  22. $driver->setMemcache($this->_memcache);
  23. return $driver;
  24. }
  25. }