/** * Overrides TestCaseCache::testCacheTimeout to deal with the adapter's stored time values in this test * * @testdox The cache handler correctly handles expired cache data * * @medium */ public function testCacheTimeout() { /** @var Cache_Lite $cacheLiteInstance */ $cacheLiteInstance = TestReflection::getValue('JCacheStorageCachelite', 'CacheLiteInstance'); $cacheLiteInstance->_lifeTime = 0.1; // For parent class $this->handler->_lifetime =& $cacheLiteInstance->_lifeTime; parent::testCacheTimeout(); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { if (!JCacheStorageApc::isSupported() || $this->isBlacklisted('apc')) { $this->markTestSkipped('The APC cache handler is not supported on this system.'); } parent::setUp(); $this->handler = new JCacheStorageApc(); // Override the lifetime because the JCacheStorage API multiplies it by 60 (converts minutes to seconds) $this->handler->_lifetime = 2; }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { if (!JCacheStorageFile::isSupported() || $this->isBlacklisted('file')) { $this->markTestSkipped('The file cache handler is not supported on this system.'); } parent::setUp(); $this->handler = new JCacheStorageFile(array('cachebase' => JPATH_CACHE)); // Override the lifetime because the JCacheStorage API multiplies it by 60 (converts minutes to seconds) $this->handler->_lifetime = 2; }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { if (!JCacheStorageRedis::isSupported()) { $this->markTestSkipped('The Redis cache handler is not supported on this system.'); } parent::setUp(); $this->handler = new JCacheStorageRedis(); // This adapter doesn't throw an Exception on a connection failure so we'll have to use Reflection to get into the class to check it if (!TestReflection::getValue($this->handler, '_redis') instanceof Redis) { $this->markTestSkipped('Failed to connect to Redis'); } // Override the lifetime because the JCacheStorage API multiplies it by 60 (converts minutes to seconds) $this->handler->_lifetime = 2; }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { if (!JCacheStorageMemcache::isSupported()) { $this->markTestSkipped('The Memcache cache handler is not supported on this system.'); } parent::setUp(); try { $this->handler = new JCacheStorageMemcache(); } catch (JCacheExceptionConnecting $e) { $this->markTestSkipped('Failed to connect to Memcache'); } // Override the lifetime because the JCacheStorage API multiplies it by 60 (converts minutes to seconds) $this->handler->_lifetime = 2; }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { if (!JCacheStorageRedis::isSupported()) { $this->markTestSkipped('The Redis cache handler is not supported on this system.'); } parent::setUp(); // Mock the returns on JApplicationCms::get() to use the default values JFactory::$application->expects($this->any())->method('get')->willReturnArgument(1); $this->handler = new JCacheStorageRedis(); // This adapter doesn't throw an Exception on a connection failure so we'll have to use Reflection to get into the class to check it if (!TestReflection::getValue($this->handler, '_redis') instanceof Redis) { $this->markTestSkipped('Failed to connect to Redis'); } // Override the lifetime because the JCacheStorage API multiplies it by 60 (converts minutes to seconds) $this->handler->_lifetime = 2; }
/** * Tears down the fixture, for example, close a network connection. * This method is called after a test is executed. * * @return void */ protected function tearDown() { parent::tearDown(); // Reset the Cache_Lite instance. TestReflection::setValue('JCacheStorageCachelite', 'CacheLiteInstance', null); }