Adding tests for Cache not generating errors when Cache.disable = true. Refs #286

This commit is contained in:
Mark Story 2010-02-13 18:51:39 -05:00
parent 3f667eb412
commit 6ccc43d776

View file

@ -68,6 +68,23 @@ class CacheTest extends CakeTestCase {
$this->assertTrue(isset($results['settings'])); $this->assertTrue(isset($results['settings']));
} }
/**
* Check that no fatal errors are issued doing normal things when Cache.disable is true.
*
* @return void
*/
function testNonFatalErrorsWithCachedisable() {
Configure::write('Cache.disable', true);
Cache::config('test', array('engine' => 'File', 'path' => TMP, 'prefix' => 'error_test_'));
Cache::write('no_save', 'Noooo!', 'test');
Cache::read('no_save', 'test');
Cache::delete('no_save', 'test');
Cache::set('duration', '+10 minutes');
Configure::write('Cache.disable', false);
}
/** /**
* test configuring CacheEngines in App/libs * test configuring CacheEngines in App/libs
* *
@ -157,7 +174,7 @@ class CacheTest extends CakeTestCase {
Cache::config('test_name'); Cache::config('test_name');
$result = Cache::read('value_one'); $result = Cache::read('value_one');
$this->assertEqual($result, 'I am cached'); $this->assertEqual($result, 'I am cached');
Cache::delete('value_one'); Cache::delete('value_one');
Cache::config('default'); Cache::config('default');
Cache::delete('value_one'); Cache::delete('value_one');
@ -190,7 +207,7 @@ class CacheTest extends CakeTestCase {
} }
/** /**
* test that configured returns an array of the currently configured cache * test that configured returns an array of the currently configured cache
* settings * settings
* *
* @return void * @return void
@ -225,7 +242,7 @@ class CacheTest extends CakeTestCase {
} }
/** /**
* test that drop removes cache configs, and that further attempts to use that config * test that drop removes cache configs, and that further attempts to use that config
* do not work. * do not work.
* *
* @return void * @return void
@ -242,7 +259,7 @@ class CacheTest extends CakeTestCase {
$_testsConfig = Cache::config('tests'); $_testsConfig = Cache::config('tests');
$result = Cache::drop('tests'); $result = Cache::drop('tests');
$this->assertTrue($result); $this->assertTrue($result);
Cache::config('unconfigTest', array( Cache::config('unconfigTest', array(
'engine' => 'TestAppCache' 'engine' => 'TestAppCache'
)); ));