Exemplo n.º 1
0
 /**
  * This method MUST be implemented by each driver to setup the `Cache`
  * instance for each test.
  * 
  * This method should do the following tasks for each driver test:
  * 
  *  - Test the Cache instance driver is available, skip test otherwise
  *  - Setup the Cache instance
  *  - Call the parent setup method, `parent::setUp()`
  *
  * @return  void
  */
 public function setUp()
 {
     parent::setUp();
     if (!extension_loaded('apc')) {
         $this->markTestSkipped('APC PHP Extension is not available');
     }
     if (ini_get('apc.enable_cli') != '1') {
         $this->markTestSkipped('Unable to test APC in CLI mode. To fix ' . 'place "apc.enable_cli=1" in your php.ini file');
     }
     $this->cache(Cache::instance('apc'));
 }
 /**
  * This method MUST be implemented by each driver to setup the `Cache`
  * instance for each test.
  * 
  * This method should do the following tasks for each driver test:
  * 
  *  - Test the Cache instance driver is available, skip test otherwise
  *  - Setup the Cache instance
  *  - Call the parent setup method, `parent::setUp()`
  *
  * @return  void
  */
 public function setUp()
 {
     parent::setUp();
     if (!extension_loaded('apc')) {
         $this->markTestSkipped('APC PHP Extension is not available');
     }
     if (ini_get('apc.enable_cli') != '1') {
         $this->markTestSkipped('Unable to test APC in CLI mode. To fix ' . 'place "apc.enable_cli=1" in your php.ini file');
     }
     if (!Kohana::$config->load('cache.apc')) {
         Kohana::$config->load('cache')->set('apc', array('driver' => 'apc', 'default_expire' => 3600));
     }
     $this->cache(Cache::instance('apc'));
 }
Exemplo n.º 3
0
 /**
  * This method MUST be implemented by each driver to setup the `Cache`
  * instance for each test.
  * 
  * This method should do the following tasks for each driver test:
  * 
  *  - Test the Cache instance driver is available, skip test otherwise
  *  - Setup the Cache instance
  *  - Call the parent setup method, `parent::setUp()`
  *
  * @return  void
  */
 public function setUp()
 {
     parent::setUp();
     if (!extension_loaded('apcu')) {
         $this->markTestSkipped('APCu PHP Extension is not available');
     }
     if (!(ini_get('apc.enabled') and ini_get('apc.enable_cli'))) {
         $this->markTestSkipped('APCu is not enabled. To fix ' . 'set "apc.enabled=1" and "apc.enable_cli=1" in your php.ini file');
     }
     if (!Kohana::$config->load('cache.apcu')) {
         Kohana::$config->load('cache')->set('apcu', array('driver' => 'apcu', 'default_expire' => 3600));
     }
     $this->cache(Cache::instance('apcu'));
 }
Exemplo n.º 4
0
 /**
  * This method MUST be implemented by each driver to setup the `Cache`
  * instance for each test.
  * 
  * This method should do the following tasks for each driver test:
  * 
  *  - Test the Cache instance driver is available, skip test otherwise
  *  - Setup the Cache instance
  *  - Call the parent setup method, `parent::setUp()`
  *
  * @return  void
  */
 public function setUp()
 {
     parent::setUp();
     if (!extension_loaded('memcache')) {
         $this->markTestSkipped('Memcache PHP Extension is not available');
     }
     if (!($config = Kohana::$config->load('cache')->memcache)) {
         $this->markTestSkipped('Unable to load Memcache configuration');
     }
     $memcache = new Memcache();
     if (!$memcache->connect($config['servers'][0]['host'], $config['servers'][0]['port'])) {
         $this->markTestSkipped('Unable to connect to memcache server @ ' . $config['servers'][0]['host'] . ':' . $config['servers'][0]['port']);
     }
     if ($memcache->getVersion() === FALSE) {
         $this->markTestSkipped('Memcache server @ ' . $config['servers'][0]['host'] . ':' . $config['servers'][0]['port'] . ' not responding!');
     }
     unset($memcache);
     $this->cache(Cache::instance('memcache'));
 }
 /**
  * This method MUST be implemented by each driver to setup the `Cache`
  * instance for each test.
  * 
  * This method should do the following tasks for each driver test:
  * 
  *  - Test the Cache instance driver is available, skip test otherwise
  *  - Setup the Cache instance
  *  - Call the parent setup method, `parent::setUp()`
  *
  * @return  void
  */
 public function setUp()
 {
     parent::setUp();
     if (!extension_loaded('memcache')) {
         $this->markTestSkipped('Memcache PHP Extension is not available');
     }
     if (!($config = Kohana::$config->load('cache.memcache'))) {
         Kohana::$config->load('cache')->set('memcache', array('driver' => 'memcache', 'default_expire' => 3600, 'compression' => FALSE, 'servers' => array('local' => array('host' => 'localhost', 'port' => 11211, 'persistent' => FALSE, 'weight' => 1, 'timeout' => 1, 'retry_interval' => 15, 'status' => TRUE)), 'instant_death' => TRUE));
         $config = Kohana::$config->load('cache.memcache');
     }
     $memcache = new Memcache();
     if (!$memcache->connect($config['servers']['local']['host'], $config['servers']['local']['port'])) {
         $this->markTestSkipped('Unable to connect to memcache server @ ' . $config['servers']['local']['host'] . ':' . $config['servers']['local']['port']);
     }
     if ($memcache->getVersion() === FALSE) {
         $this->markTestSkipped('Memcache server @ ' . $config['servers']['local']['host'] . ':' . $config['servers']['local']['port'] . ' not responding!');
     }
     unset($memcache);
     $this->cache(Cache::instance('memcache'));
 }