RedisCacheTest.php 727 B

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