public function testCanConstructDoctrineCache() { if (!interface_exists('\\Doctrine\\Common\\Cache\\Cache')) { $this->markTestSkipped('Doctrine cache interface is not available'); } $cache = $this->getMockBuilder('\\Doctrine\\Common\\Cache\\Cache')->disableOriginalConstructor()->getMockForAbstractClass(); $instance = new CacheFactory(); $this->assertInstanceOf('\\Onoi\\Cache\\DoctrineCache', $instance->newDoctrineCache($cache)); }
protected function setUp() { $cache = array(); $cacheFactory = new CacheFactory(); $cache[] = $cacheFactory->newFixedInMemoryLruCache(); if (class_exists('\\HashBagOStuff')) { $cache[] = $cacheFactory->newMediaWikiCache(new HashBagOStuff()); } if (class_exists('\\Doctrine\\Common\\Cache\\ArrayCache')) { $cache[] = $cacheFactory->newDoctrineCache(new ArrayCache()); } $this->cache = $cacheFactory->newCompositeCache($cache); }
protected function setUp() { if (!class_exists('\\Onoi\\Cache\\CacheFactory')) { $this->markTestSkipped('CacheFactory is not available'); } if (!class_exists('\\Redis')) { $this->markTestSkipped('Requires redis php-class/extension to be available'); } $redis = new \Redis(); if (!$redis->connect('127.0.0.1')) { $this->markTestSkipped('Cannot connect to redis'); } if (!class_exists('\\Doctrine\\Common\\Cache\\RedisCache')) { $this->markTestSkipped('RedisCache is not available'); } $redisCache = new RedisCache(); $redisCache->setRedis($redis); $cacheFactory = new CacheFactory(); $this->cache = $cacheFactory->newDoctrineCache($redisCache); }