Ejemplo n.º 1
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->skipIf(!class_exists('Redis'), 'Redis is not installed or configured properly.');
     Cache::enable();
     $this->_configCache();
 }
 /**
  * Setup function
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->connection = ConnectionManager::get('test');
     Cache::clear(false, '_cake_method_');
     Cache::enable();
 }
 /**
  * testCacheDisabled method
  *
  * @return void
  */
 public function testCacheDisabled()
 {
     Cache::disable();
     $result = $this->_testEnabled();
     $this->assertEquals(false, $result);
     Cache::enable();
 }
Ejemplo n.º 4
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Cache::enable();
     $this->_configCache();
     Cache::clear(false, 'file_test');
 }
Ejemplo n.º 5
0
 /**
  * test case startup
  *
  * @return void
  */
 public static function setupBeforeClass()
 {
     Cache::enable();
     Cache::config('session_test', ['engine' => 'File', 'path' => TMP . 'sessions', 'prefix' => 'session_test']);
     static::$_sessionBackup = Configure::read('Session');
     Configure::write('Session.handler.config', 'session_test');
 }
Ejemplo n.º 6
0
 /**
  * Setup method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->engine = $this->getMock('Cake\\Cache\\CacheEngine');
     $this->engine->expects($this->any())->method('init')->will($this->returnValue(true));
     Cache::config('queryCache', $this->engine);
     Cache::enable();
 }
Ejemplo n.º 7
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->skipIf(!function_exists('wincache_ucache_set'), 'Wincache is not installed or configured properly.');
     $this->skipIf(!ini_get('wincache.enablecli'), 'Wincache is not enabled on the CLI.');
     Cache::enable();
     $this->_configCache();
 }
Ejemplo n.º 8
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     $this->assertFalse(defined('HHVM_VERSION'), 'Crashes HHVM');
     parent::setUp();
     $this->skipIf(!class_exists('Redis'), 'Redis is not installed or configured properly.');
     Cache::enable();
     $this->_configCache();
 }
Ejemplo n.º 9
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     if (!function_exists('xcache_set')) {
         $this->markTestSkipped('Xcache is not installed or configured properly');
     }
     Cache::enable();
     Cache::config('xcache', ['engine' => 'Xcache', 'prefix' => 'cake_']);
 }
Ejemplo n.º 10
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->skipIf(!function_exists('apc_store'), 'Apc is not installed or configured properly.');
     if (php_sapi_name() === 'cli') {
         $this->skipIf(!ini_get('apc.enable_cli'), 'APC is not enabled for the CLI.');
     }
     Cache::enable();
     $this->_configCache();
 }
Ejemplo n.º 11
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->skipIf(!function_exists('apcu_store'), 'APCu is not installed or configured properly.');
     if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
         $this->skipIf(!ini_get('apc.enable_cli'), 'APC is not enabled for the CLI.');
     }
     Cache::enable();
     $this->_configCache();
 }
Ejemplo n.º 12
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->skipIf(!class_exists('Redis'), 'Redis extension is not installed or configured properly.');
     // @codingStandardsIgnoreStart
     $socket = @fsockopen('127.0.0.1', 6379, $errno, $errstr, 1);
     // @codingStandardsIgnoreEnd
     $this->skipIf(!$socket, 'Redis is not running.');
     fclose($socket);
     Cache::enable();
     $this->_configCache();
 }
Ejemplo n.º 13
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
         $this->markTestSkipped('Xcache is not available for the CLI.');
     }
     if (!function_exists('xcache_set')) {
         $this->markTestSkipped('Xcache is not installed or configured properly');
     }
     Cache::enable();
     Cache::config('xcache', ['engine' => 'Xcache', 'prefix' => 'cake_']);
 }
Ejemplo n.º 14
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->Connection = ConnectionManager::get('test');
     $this->Collection = new Collection($this->Connection);
     $this->View = new View();
     $this->Helper = new MigrationHelper($this->View, ['collection' => $this->Collection]);
     Cache::clear(false, '_cake_model_');
     Cache::enable();
     $this->loadFixtures('Users');
     $this->loadFixtures('SpecialTags');
     $this->values = ['null' => 'NULL', 'integerNull' => null, 'integerLimit' => null, 'comment' => null];
     if (getenv('DB') == 'mysql') {
         $this->values = ['null' => null, 'integerNull' => null, 'integerLimit' => 11, 'comment' => ''];
     }
     if (getenv('DB') == 'pgsql') {
         $this->values = ['null' => null, 'integerNull' => null, 'integerLimit' => 10, 'comment' => null];
     }
 }
Ejemplo n.º 15
0
 /**
  * testFullPageCachingDispatch method
  *
  * @dataProvider cacheActionProvider
  * @return void
  */
 public function testFullPageCachingDispatch($url)
 {
     Cache::enable();
     Configure::write('Cache.disable', false);
     Configure::write('Cache.check', true);
     Configure::write('debug', true);
     Router::reload();
     Router::connect('/', array('controller' => 'test_cached_pages', 'action' => 'index'));
     Router::connect('/:controller/:action/*');
     $dispatcher = new TestDispatcher();
     $request = new Request($url);
     $response = $this->getMock('Cake\\Network\\Response', array('send'));
     $dispatcher->dispatch($request, $response);
     $out = $response->body();
     Configure::write('Dispatcher.filters', array('CacheDispatcher'));
     $request = new Request($url);
     $response = $this->getMock('Cake\\Network\\Response', array('send'));
     $dispatcher = new TestDispatcher();
     $dispatcher->dispatch($request, $response);
     $cached = $response->body();
     $cached = preg_replace('/<!--+[^<>]+-->/', '', $cached);
     $this->assertTextEquals($out, $cached);
     $filename = $this->_cachePath($request->here());
     unlink($filename);
 }
Ejemplo n.º 16
0
 /**
  * test that store and restore only store/restore the provided data.
  *
  * @return void
  */
 public function testStoreAndRestoreWithData()
 {
     Cache::enable();
     Cache::config('configure', ['className' => 'File', 'path' => TMP . 'tests']);
     Configure::write('testing', 'value');
     Configure::store('store_test', 'configure', ['store_test' => 'one']);
     Configure::delete('testing');
     $this->assertNull(Configure::read('store_test'), 'Calling store with data shouldn\'t modify runtime.');
     Configure::restore('store_test', 'configure');
     $this->assertEquals('one', Configure::read('store_test'));
     $this->assertNull(Configure::read('testing'), 'Values that were not stored are not restored.');
     Cache::delete('store_test', 'configure');
     Cache::drop('configure');
 }
Ejemplo n.º 17
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $_GET = [];
     $request = new Request();
     $this->Controller = new CacheTestController($request);
     $View = $this->Controller->createView();
     $this->Cache = new CacheHelper($View);
     Configure::write('Cache.check', true);
     Cache::enable();
 }
Ejemplo n.º 18
0
 /**
  * Test toggling enabled state of cache.
  *
  * @return void
  */
 public function testEnableDisableEnabled()
 {
     $this->assertNull(Cache::enable());
     $this->assertTrue(Cache::enabled(), 'Should be on');
     $this->assertNull(Cache::disable());
     $this->assertFalse(Cache::enabled(), 'Should be off');
 }
Ejemplo n.º 19
0
 /**
  * test cache()
  *
  * @return void
  */
 public function testCache()
 {
     Cache::disable();
     $result = cache('basics_test', 'simple cache write');
     $this->assertNull($result);
     $result = cache('basics_test');
     $this->assertNull($result);
     Cache::enable();
     $result = cache('basics_test', 'simple cache write');
     $this->assertTrue((bool) $result);
     $this->assertTrue(file_exists(CACHE . 'basics_test'));
     $result = cache('basics_test');
     $this->assertEquals('simple cache write', $result);
     if (file_exists(CACHE . 'basics_test')) {
         unlink(CACHE . 'basics_test');
     }
     cache('basics_test', 'expired', '+1 second');
     sleep(2);
     $result = cache('basics_test', null, '+1 second');
     $this->assertNull($result);
 }