Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding tests for Cache not generating errors when Cache.disable = tru…
…e. Refs #286
  • Loading branch information
markstory committed Feb 13, 2010
1 parent 3f667eb commit 6ccc43d
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions cake/tests/cases/libs/cache.test.php
Expand Up @@ -68,6 +68,23 @@ function testConfig() {
$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
* *
Expand Down Expand Up @@ -157,7 +174,7 @@ function testConfigSettingDefaultConfigKey() {
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');
Expand Down Expand Up @@ -190,7 +207,7 @@ function testWritingWithConfig() {
} }


/** /**
* 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
Expand Down Expand Up @@ -225,7 +242,7 @@ function testInitSettings() {
} }


/** /**
* 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
Expand All @@ -242,7 +259,7 @@ function testDrop() {
$_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'
)); ));
Expand Down

0 comments on commit 6ccc43d

Please sign in to comment.