예제 #1
0
    public function setUp()
    {
        if (!defined('TESTS_ZEND_CACHE_WINCACHE_ENABLED') || !TESTS_ZEND_CACHE_WINCACHE_ENABLED) {
            $this->markTestSkipped("Skipped by TestConfiguration (TESTS_ZEND_CACHE_WINCACHE_ENABLED)");
        }

        if (!extension_loaded('wincache')) {
            $this->markTestSkipped("WinCache extension is not loaded");
        }

        $enabled = ini_get('wincache.ucenabled');
        if (PHP_SAPI == 'cli') {
            $enabled = $enabled && (bool) ini_get('wincache.enablecli');
        }

        if (!$enabled) {
            throw new Exception\ExtensionNotLoadedException(
                "WinCache is disabled - see 'wincache.ucenabled' and 'wincache.enablecli'"
            );
        }

        $this->_options = new Cache\Storage\Adapter\WinCacheOptions();
        $this->_storage = new Cache\Storage\Adapter\WinCache();
        $this->_storage->setOptions($this->_options);

        parent::setUp();
    }
예제 #2
0
 public function setUp()
 {
     if (!defined('TESTS_ZEND_CACHE_REDIS_ENABLED') || !TESTS_ZEND_CACHE_REDIS_ENABLED) {
         $this->markTestSkipped("Skipped by TestConfiguration (TESTS_ZEND_CACHE_REDIS_ENABLED)");
     }
     if (!extension_loaded('redis')) {
         $this->markTestSkipped("Redis extension is not loaded");
     }
     $this->_options = new Cache\Storage\Adapter\RedisOptions(array('resource_id' => __CLASS__));
     if (defined('TESTS_ZEND_CACHE_REDIS_HOST') && defined('TESTS_ZEND_CACHE_REDIS_PORT')) {
         $this->_options->getResourceManager()->setServer(__CLASS__, array(TESTS_ZEND_CACHE_REDIS_HOST, TESTS_ZEND_CACHE_REDIS_PORT, 1));
     } elseif (defined('TESTS_ZEND_CACHE_REDIS_HOST')) {
         $this->_options->getResourceManager()->setServer(__CLASS__, array(TESTS_ZEND_CACHE_REDIS_HOST));
     }
     if (defined('TESTS_ZEND_CACHE_REDIS_DATABASE')) {
         $this->_options->getResourceManager()->setDatabase(__CLASS__, TESTS_ZEND_CACHE_REDIS_DATABASE);
     }
     if (defined('TESTS_ZEND_CACHE_REDIS_PASSWORD')) {
         $this->_options->getResourceManager()->setPassword(__CLASS__, TESTS_ZEND_CACHE_REDIS_PASSWORD);
     }
     $this->_storage = new Cache\Storage\Adapter\Redis();
     $this->_storage->setOptions($this->_options);
     $this->_storage->flush();
     parent::setUp();
 }
예제 #3
0
 public function setUp()
 {
     if (!defined('TESTS_ZEND_CACHE_APC_ENABLED') || !TESTS_ZEND_CACHE_APC_ENABLED) {
         $this->markTestSkipped("Skipped by TestConfiguration (TESTS_ZEND_CACHE_APC_ENABLED)");
     }
     if (version_compare('3.1.6', phpversion('apc')) > 0) {
         try {
             new Cache\Storage\Adapter\Apc();
             $this->fail("Expected exception Zend\\Cache\\Exception\\ExtensionNotLoadedException");
         } catch (Cache\Exception\ExtensionNotLoadedException $e) {
             $this->markTestSkipped("Missing ext/apc >= 3.1.6");
         }
     }
     $enabled = (bool) ini_get('apc.enabled');
     if (PHP_SAPI == 'cli') {
         $enabled = $enabled && (bool) ini_get('apc.enable_cli');
     }
     if (!$enabled) {
         try {
             new Cache\Storage\Adapter\Apc();
             $this->fail("Expected exception Zend\\Cache\\Exception\\ExtensionNotLoadedException");
         } catch (Cache\Exception\ExtensionNotLoadedException $e) {
             $this->markTestSkipped("ext/apc is disabled - see 'apc.enabled' and 'apc.enable_cli'");
         }
     }
     // needed on test expirations
     $this->iniUseRequestTime = ini_get('apc.use_request_time');
     ini_set('apc.use_request_time', 0);
     $this->_options = new Cache\Storage\Adapter\ApcOptions();
     $this->_storage = new Cache\Storage\Adapter\Apc();
     $this->_storage->setOptions($this->_options);
     parent::setUp();
 }
예제 #4
0
 public function setUp()
 {
     // instantiate memory adapter
     $this->_options = new Cache\Storage\Adapter\MemoryOptions();
     $this->_storage = new Cache\Storage\Adapter\Memory();
     $this->_storage->setOptions($this->_options);
     parent::setUp();
 }
예제 #5
0
 public function setUp()
 {
     if (!extension_loaded('memcached')) {
         $this->markTestSkipped("Memcached extension is not loaded");
     }
     $this->_options = new Cache\Storage\Adapter\MemcachedOptions();
     $this->_storage = new Cache\Storage\Adapter\Memcached($this->_options);
     parent::setUp();
 }
예제 #6
0
 public function setUp()
 {
     $_SESSION = array();
     SessionContainer::setDefaultManager(null);
     $sessionConfig = new SessionConfig(array('storage' => 'Zend\\Session\\Storage\\ArrayStorage'));
     $sessionManager = $manager = new TestSessionManager($sessionConfig);
     $sessionContainer = new SessionContainer('Default', $manager);
     $this->_options = new Cache\Storage\Adapter\SessionOptions(array('session_container' => $sessionContainer));
     $this->_storage = new Cache\Storage\Adapter\Session();
     $this->_storage->setOptions($this->_options);
     parent::setUp();
 }
예제 #7
0
 public function setUp()
 {
     if (!function_exists('zend_disk_cache_store') || PHP_SAPI == 'cli') {
         try {
             new Cache\Storage\Adapter\ZendServerDisk();
             $this->fail("Missing expected ExtensionNotLoadedException");
         } catch (Exception\ExtensionNotLoadedException $e) {
             $this->markTestSkipped($e->getMessage());
         }
     }
     $this->_storage = new Cache\Storage\Adapter\ZendServerDisk();
     parent::setUp();
 }
예제 #8
0
 public function setUp()
 {
     if (!defined('TESTS_ZEND_CACHE_ZEND_SERVER_ENABLED') || !TESTS_ZEND_CACHE_ZEND_SERVER_ENABLED) {
         $this->markTestSkipped("Skipped by TestConfiguration (TESTS_ZEND_CACHE_ZEND_SERVER_ENABLED)");
     }
     if (!function_exists('zend_disk_cache_store') || PHP_SAPI == 'cli') {
         try {
             new Cache\Storage\Adapter\ZendServerDisk();
             $this->fail("Missing expected ExtensionNotLoadedException");
         } catch (Exception\ExtensionNotLoadedException $e) {
             $this->markTestSkipped($e->getMessage());
         }
     }
     $this->_options = new Cache\Storage\Adapter\AdapterOptions();
     $this->_storage = new Cache\Storage\Adapter\ZendServerDisk($this->_options);
     parent::setUp();
 }
예제 #9
0
 public function setUp()
 {
     if (strtolower(PHP_SAPI) == 'cli') {
         $this->markTestSkipped('Zend Server SHM does not work in CLI environment');
         return;
     }
     if (!function_exists('zend_shm_cache_store')) {
         try {
             new Cache\Storage\Adapter\ZendServerShm();
             $this->fail("Missing expected ExtensionNotLoadedException");
         } catch (Exception\ExtensionNotLoadedException $e) {
             $this->markTestSkipped($e->getMessage());
         }
     }
     $this->_storage = new Cache\Storage\Adapter\ZendServerShm();
     parent::setUp();
 }
예제 #10
0
 public function setUp()
 {
     if (!defined('TESTS_ZEND_CACHE_MEMCACHED_ENABLED') || !TESTS_ZEND_CACHE_MEMCACHED_ENABLED) {
         $this->markTestSkipped("Skipped by TestConfiguration (TESTS_ZEND_CACHE_MEMCACHED_ENABLED)");
     }
     if (!extension_loaded('memcached')) {
         $this->markTestSkipped("Memcached extension is not loaded");
     }
     $this->_options = new Cache\Storage\Adapter\MemcachedOptions();
     if (defined('TESTS_ZEND_CACHE_MEMCACHED_HOST') && defined('TESTS_ZEND_CACHE_MEMCACHED_PORT')) {
         $this->_options->addServer(TESTS_ZEND_CACHE_MEMCACHED_HOST, TESTS_ZEND_CACHE_MEMCACHED_PORT);
     } elseif (defined('TESTS_ZEND_CACHE_MEMCACHED_HOST')) {
         $this->_options->addServer(TESTS_ZEND_CACHE_MEMCACHED_HOST);
     }
     $this->_storage = new Cache\Storage\Adapter\Memcached($this->_options);
     parent::setUp();
 }
예제 #11
0
 public function setUp()
 {
     $this->_tmpCacheDir = @tempnam(sys_get_temp_dir(), 'zend_cache_test_');
     if (!$this->_tmpCacheDir) {
         $err = error_get_last();
         $this->fail("Can't create temporary cache directory-file: {$err['message']}");
     } elseif (!@unlink($this->_tmpCacheDir)) {
         $err = error_get_last();
         $this->fail("Can't remove temporary cache directory-file: {$err['message']}");
     } elseif (!@mkdir($this->_tmpCacheDir, 0777)) {
         $err = error_get_last();
         $this->fail("Can't create temporaty cache directory: {$err['message']}");
     }
     $this->_options = new Cache\Storage\Adapter\FilesystemOptions(array('cache_dir' => $this->_tmpCacheDir));
     $this->_storage = new Cache\Storage\Adapter\Filesystem();
     $this->_storage->setOptions($this->_options);
     parent::setUp();
 }
예제 #12
0
 public function setUp()
 {
     if (!defined('TESTS_ZEND_CACHE_MEMCACHED_ENABLED') || !TESTS_ZEND_CACHE_MEMCACHED_ENABLED) {
         $this->markTestSkipped("Skipped by TestConfiguration (TESTS_ZEND_CACHE_MEMCACHED_ENABLED)");
     }
     if (!extension_loaded('memcached')) {
         $this->markTestSkipped("Memcached extension is not loaded");
     }
     $this->_options = new Cache\Storage\Adapter\MemcachedOptions(array('resource_id' => __CLASS__));
     if (defined('TESTS_ZEND_CACHE_MEMCACHED_HOST') && defined('TESTS_ZEND_CACHE_MEMCACHED_PORT')) {
         $this->_options->getResourceManager()->setServers(__CLASS__, array(array(TESTS_ZEND_CACHE_MEMCACHED_HOST, TESTS_ZEND_CACHE_MEMCACHED_PORT)));
     } elseif (defined('TESTS_ZEND_CACHE_MEMCACHED_HOST')) {
         $this->_options->getResourceManager()->setServers(__CLASS__, array(array(TESTS_ZEND_CACHE_MEMCACHED_HOST)));
     }
     $this->_storage = new Cache\Storage\Adapter\Memcached();
     $this->_storage->setOptions($this->_options);
     $this->_storage->flush();
     parent::setUp();
 }
예제 #13
0
 public function setUp()
 {
     if (!defined('TESTS_ZEND_CACHE_ZEND_SERVER_ENABLED') || !TESTS_ZEND_CACHE_ZEND_SERVER_ENABLED) {
         $this->markTestSkipped("Skipped by TestConfiguration (TESTS_ZEND_CACHE_ZEND_SERVER_ENABLED)");
     }
     if (strtolower(PHP_SAPI) == 'cli') {
         $this->markTestSkipped('Zend Server SHM does not work in CLI environment');
         return;
     }
     if (!function_exists('zend_shm_cache_store')) {
         try {
             new Cache\Storage\Adapter\ZendServerShm();
             $this->fail("Missing expected ExtensionNotLoadedException");
         } catch (Exception\ExtensionNotLoadedException $e) {
             $this->markTestSkipped($e->getMessage());
         }
     }
     $this->_options = new Cache\Storage\Adapter\AdapterOptions();
     $this->_storage = new Cache\Storage\Adapter\ZendServerShm($this->_options);
     parent::setUp();
 }
예제 #14
0
 public function setUp()
 {
     if (!extension_loaded('dba')) {
         try {
             new Cache\Storage\Adapter\Dba();
             $this->fail("Expected exception Zend\\Cache\\Exception\\ExtensionNotLoadedException");
         } catch (Cache\Exception\ExtensionNotLoadedException $e) {
             $this->markTestSkipped("Missing ext/dba");
         }
     }
     if (!in_array($this->handler, dba_handlers())) {
         try {
             new Cache\Storage\Adapter\DbaOptions(array('handler' => $this->handler));
             $this->fail("Expected exception Zend\\Cache\\Exception\\ExtensionNotLoadedException");
         } catch (Cache\Exception\ExtensionNotLoadedException $e) {
             $this->markTestSkipped("Missing ext/dba handler '{$this->handler}'");
         }
     }
     $this->temporaryDbaFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('zfcache_dba_');
     $this->_options = new Cache\Storage\Adapter\DbaOptions(array('pathname' => $this->temporaryDbaFile, 'handler' => $this->handler));
     $this->_storage = new Cache\Storage\Adapter\Dba();
     $this->_storage->setOptions($this->_options);
     parent::setUp();
 }
예제 #15
0
 public function setUp()
 {
     if (!defined('TESTS_ZEND_CACHE_XCACHE_ENABLED') || !TESTS_ZEND_CACHE_XCACHE_ENABLED) {
         $this->markTestSkipped("Skipped by TestConfiguration (TESTS_ZEND_CACHE_XCACHE_ENABLED)");
     }
     if (!extension_loaded('xcache')) {
         try {
             new Cache\Storage\Adapter\XCache();
             $this->fail("Expected exception Zend\\Cache\\Exception\\ExtensionNotLoadedException");
         } catch (Cache\Exception\ExtensionNotLoadedException $e) {
             $this->markTestSkipped($e->getMessage());
         }
     }
     if (PHP_SAPI == 'cli') {
         try {
             new Cache\Storage\Adapter\XCache();
             $this->fail("Expected exception Zend\\Cache\\Exception\\ExtensionNotLoadedException");
         } catch (Cache\Exception\ExtensionNotLoadedException $e) {
             $this->markTestSkipped($e->getMessage());
         }
     }
     if ((int) ini_get('xcache.var_size') <= 0) {
         try {
             new Cache\Storage\Adapter\XCache();
             $this->fail("Expected exception Zend\\Cache\\Exception\\ExtensionNotLoadedException");
         } catch (Cache\Exception\ExtensionNotLoadedException $e) {
             $this->markTestSkipped($e->getMessage());
         }
     }
     $this->_options = new Cache\Storage\Adapter\XCacheOptions(array('admin_auth' => defined('TESTS_ZEND_CACHE_XCACHE_ADMIN_AUTH') ? TESTS_ZEND_CACHE_XCACHE_ADMIN_AUTH : false, 'admin_user' => defined('TESTS_ZEND_CACHE_XCACHE_ADMIN_USER') ? TESTS_ZEND_CACHE_XCACHE_ADMIN_USER : '', 'admin_pass' => defined('TESTS_ZEND_CACHE_XCACHE_ADMIN_PASS') ? TESTS_ZEND_CACHE_XCACHE_ADMIN_PASS : ''));
     $this->_storage = new Cache\Storage\Adapter\XCache();
     $this->_storage->setOptions($this->_options);
     // dfsdfdsfsdf
     $this->backupServerArray = $_SERVER;
     parent::setUp();
 }