/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { include_once JPATH_PLATFORM . '/joomla/cache/storage.php'; include_once JPATH_PLATFORM . '/joomla/cache/storage/xcache.php'; $this->xcacheAvailable = extension_loaded('xcache'); $this->object = JCacheStorage::getInstance('xcache'); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void * @access protected */ protected function setUp() { include_once JPATH_BASE . '/libraries/joomla/cache/storage.php'; include_once JPATH_BASE . '/libraries/joomla/cache/storage/apc.php'; $this->object = JCacheStorage::getInstance('apc'); $this->apcAvailable = extension_loaded('apc'); }
public function __construct($options = array()) { $this->_root = JPATH_ADMINISTRATOR . '/cache'; $this->_hash = JFactory::getConfig()->get('secret'); $cache = new JCacheStorage(); $this->_cache = $cache->getInstance('file', array('cachebase' => $this->_root)); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void * @access protected */ protected function setUp() { include_once JPATH_BASE . '/libraries/joomla/cache/storage.php'; include_once JPATH_BASE . '/libraries/joomla/cache/storage/eaccelerator.php'; $this->eacceleratorAvailable = extension_loaded('eaccelerator') && function_exists('eaccelerator_get'); $this->object = JCacheStorage::getInstance('eaccelerator'); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { include_once JPATH_PLATFORM . '/joomla/cache/storage.php'; include_once JPATH_PLATFORM . '/joomla/cache/storage/file.php'; $this->object = JCacheStorage::getInstance('file', array('cachebase' => JPATH_BASE . '/cache')); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void * @access protected */ protected function setUp() { $memcachetest = false; include_once JPATH_BASE.'/libraries/joomla/cache/storage.php'; include_once JPATH_BASE.'/libraries/joomla/cache/storage/memcache.php'; if((extension_loaded('memcache') && class_exists('Memcache')) != true ) { $this->memcacheAvailable = false; } else { $config = JFactory::getConfig(); $host = $config->get('memcache_server_host', 'localhost'); $port = $config->get('memcache_server_port',11211); $memcache = new Memcache; $memcachetest = @$memcache->connect($host, $port); } if (!$memcachetest) { $this->memcacheAvailable = false; } else $this->memcacheAvailable = true; if ($this->memcacheAvailable) { $this->object = JCacheStorage::getInstance('memcache'); } }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { parent::setUp(); $xcachetest = false; if (extension_loaded('xcache')) { // XCache Admin must be disabled for Joomla to use XCache $xcache_admin_enable_auth = ini_get('xcache.admin.enable_auth'); // Some extensions ini variables are reported as strings if ($xcache_admin_enable_auth == 'Off') { $xcachetest = true; } // We require a string with contents 0, not a null value because it is not set since that then defaults to On/True if ($xcache_admin_enable_auth === '0') { $xcachetest = true; } // In some enviorments empty is equivalent to Off; See JC: #34044 && Github: #4083 if ($xcache_admin_enable_auth === '') { $xcachetest = true; } } $this->extensionAvailable = $xcachetest; if ($this->extensionAvailable) { $this->object = JCacheStorage::getInstance('xcache'); } else { $this->markTestSkipped('This caching method is not supported on this system.'); } }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { parent::setUp(); include_once JPATH_PLATFORM . '/joomla/cache/storage.php'; include_once JPATH_PLATFORM . '/joomla/cache/storage/apc.php'; $this->object = JCacheStorage::getInstance('apc'); $this->apcAvailable = extension_loaded('apc'); }
function __construct($options = array()) { $config =& JFactory::getConfig(); jimport('joomla.cache.cache'); $cache = new JCacheStorage(); $this->_cache = $cache->getInstance('file', array('cachebase' => JPATH_ADMINISTRATOR . DS . 'cache')); $this->_root = JPATH_ADMINISTRATOR . DS . 'cache'; $this->_hash = $config->getValue('config.secret'); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { parent::setUp(); $this->extensionAvailable = extension_loaded('wincache') && function_exists('wincache_ucache_get') && !strcmp(ini_get('wincache.ucenabled'), '1'); if ($this->extensionAvailable) { $this->object = JCacheStorage::getInstance('wincache'); } else { $this->markTestSkipped('This caching method is not supported on this system.'); } }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { parent::setUp(); $this->extensionAvailable = JCacheStorageApcu::isSupported(); if ($this->extensionAvailable) { $this->object = JCacheStorage::getInstance('apcu'); } else { $this->markTestSkipped('This caching method is not supported on this system.'); } }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { parent::setUp(); $this->extensionAvailable = is_writable(JPATH_BASE . '/cache'); if ($this->extensionAvailable) { $this->object = JCacheStorage::getInstance('file', array('cachebase' => JPATH_BASE . '/cache')); } else { $this->markTestSkipped('This caching method is not supported on this system.'); } }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { parent::setUp(); $this->extensionAvailable = class_exists('Cache_Lite'); if ($this->extensionAvailable) { $options = array('cachebase' => JPATH_TESTS . '/tmp', 'caching' => true); $this->object = JCacheStorage::getInstance('cachelite', $options); } else { $this->markTestSkipped('This caching method is not supported on this system.'); } }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void * * @since 3.4 */ protected function setUp() { parent::setUp(); $this->saveFactoryState(); JFactory::$application = $this->getMockCmsApp(); $this->extensionAvailable = class_exists('Redis'); if ($this->extensionAvailable) { $this->object = JCacheStorage::getInstance('redis'); } else { $this->markTestSkipped('This caching method is not supported on this system.'); } }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $memcachetest = false; if (extension_loaded('memcache') || class_exists('Memcache')) { $config = JFactory::getConfig(); $host = $config->get('memcache_server_host', 'localhost'); $port = $config->get('memcache_server_port', 11211); $memcache = new Memcache(); $memcachetest = @$memcache->connect($host, $port); } $this->extensionAvailable = $memcachetest; if ($this->extensionAvailable) { $this->object = JCacheStorage::getInstance('memcache'); } else { $this->markTestSkipped('This caching method is not supported on this system.'); } }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $memcachedtest = false; if (extension_loaded('memcached') || class_exists('Memcached')) { $config = JFactory::getConfig(); $host = $config->get('memcached_server_host', 'localhost'); $port = $config->get('memcached_server_port', 11211); $memcached = new Memcached(); $memcachedtest = @$memcached->addServer($host, $port); } $this->extensionAvailable = $memcachedtest; $this->saveFactoryState(); if ($this->extensionAvailable) { JFactory::$session = $this->getMockSession(); $this->object = JCacheStorage::getInstance('memcached'); } else { $this->markTestSkipped('This caching method is not supported on this system.'); } }
/** * Testing getInstance * * @param string cache storage * @param array options for cache storage * @param string name of expected cache storage class * * @return void * @dataProvider casesGetInstance */ public function testGetInstance($handler, $options, $expClass) { $this->object = JCacheStorage::getInstance($handler, $options); $config = JFactory::getConfig(); $this->assertThat($this->object, $this->isInstanceOf($expClass)); $this->assertThat($this->object->_application, $this->equalTo($options['application'])); $this->assertThat($this->object->_language, $this->equalTo($options['language'])); $this->assertThat($this->object->_locking, $this->equalTo($options['locking'])); $this->assertThat($this->object->_lifetime, $this->equalTo(empty($options['lifetime']) ? $config->get('cachetime') * 60 : $options['lifetime'] * 60)); $this->assertLessThan($config->get('lifetime'), abs($this->object->_now - time())); }
/** * Get the cache storage handler * * @return JCacheStorage A JCacheStorage object * * @since 11.1 */ public function &_getStorage() { $hash = md5(serialize($this->_options)); if (isset(self::$_handler[$hash])) { return self::$_handler[$hash]; } self::$_handler[$hash] = JCacheStorage::getInstance($this->_options['storage'], $this->_options); return self::$_handler[$hash]; }
/** * Get the cache storage handler * * @access protected * @return object A JCacheStorage object * @since 1.5 */ function &_getStorage() { if (is_a($this->_handler, 'JCacheStorage')) { return $this->_handler; } $this->_handler =& JCacheStorage::getInstance($this->_options['storage'], $this->_options); return $this->_handler; }
/** * Testing getInstance * * @param string $handler cache storage * @param array $options options for cache storage * @param string $expClass name of expected cache storage class * * @return void * * @dataProvider casesGetInstance */ public function testGetInstance($handler, $options, $expClass) { if (is_bool($expClass)) { $this->markTestSkipped('The caching method ' . $handler . ' is not supported on this system.'); } $this->object = JCacheStorage::getInstance($handler, $options); if (class_exists('JTestConfig')) { $config = new JTestConfig(); } $this->assertThat($this->object, $this->isInstanceOf($expClass), 'The wrong class was received.'); $this->assertThat($this->object->_application, $this->equalTo($options['application']), 'Unexpected value for _application.'); $this->assertThat($this->object->_language, $this->equalTo($options['language']), 'Unexpected value for _language.'); $this->assertThat($this->object->_locking, $this->equalTo($options['locking']), 'Unexpected value for _locking.'); $this->assertThat($this->object->_lifetime, $this->equalTo(60), 'Unexpected value for _lifetime.'); $this->assertLessThan(isset($config->cachetime) ? $config->cachetime : 900, abs($this->object->_now - time()), 'Unexpected value for configuration lifetime.'); }
/** * Get the cache storage handler * * @return JCacheStorage A JCacheStorage object * @since 11.1 */ public function &_getStorage() { if (!isset($this->_handler)) { $this->_handler = JCacheStorage::getInstance($this->_options['storage'], $this->_options); } return $this->_handler; }
/** * Get the cache storage handler * * @return object A JCacheStorage object * @since 1.5 */ public function _getStorage() { if (isset(self::$_handler[$this->_options['storage']]) && self::$_handler[$this->_options['storage']] instanceof JCacheStorage) { return self::$_handler[$this->_options['storage']]; } self::$_handler[$this->_options['storage']] = JCacheStorage::getInstance($this->_options['storage'], $this->_options); return self::$_handler[$this->_options['storage']]; }