function testCachingSessionGetCacheDestroyed() { $this->init->config['Caching']['caching'] = 'session'; $cache = IDS_Caching::factory($this->init, 'storage'); $cache = $cache->setCache(array(1, 2, 3, 4)); $_SESSION['PHPIDS']['storage'] = null; $this->assertFalse($cache->getCache()); }
/** * Constructor * * Loads filters based on provided IDS_Init settings. * * @param object $init IDS_Init instance * * @throws Exception if unsupported filter type is given * @return void */ public final function __construct(IDS_Init $init) { if ($init->config) { $caching = isset($init->config['Caching']['caching']) ? $init->config['Caching']['caching'] : 'none'; $type = $init->config['General']['filter_type']; $this->source = $init->getBasePath() . $init->config['General']['filter_path']; if ($caching && $caching != 'none') { $this->cacheSettings = $init->config['Caching']; include_once 'IDS/Caching/Factory.php'; $this->cache = IDS_Caching::factory($init, 'storage'); } switch ($type) { case 'xml': $this->getFilterFromXML(); break; case 'json': $this->getFilterFromJson(); break; default: throw new Exception('Unsupported filter type.'); } } }