From 6ccc43d776e5a57d8ca2365f07dc7e4342018ba1 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Sat, 13 Feb 2010 18:51:39 -0500 Subject: [PATCH] Adding tests for Cache not generating errors when Cache.disable = true. Refs #286 --- cake/tests/cases/libs/cache.test.php | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/cake/tests/cases/libs/cache.test.php b/cake/tests/cases/libs/cache.test.php index 5733be94c5e..e741b2116de 100644 --- a/cake/tests/cases/libs/cache.test.php +++ b/cake/tests/cases/libs/cache.test.php @@ -68,6 +68,23 @@ function testConfig() { $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 * @@ -157,7 +174,7 @@ function testConfigSettingDefaultConfigKey() { Cache::config('test_name'); $result = Cache::read('value_one'); $this->assertEqual($result, 'I am cached'); - + Cache::delete('value_one'); Cache::config('default'); Cache::delete('value_one'); @@ -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 * * @return void @@ -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. * * @return void @@ -242,7 +259,7 @@ function testDrop() { $_testsConfig = Cache::config('tests'); $result = Cache::drop('tests'); $this->assertTrue($result); - + Cache::config('unconfigTest', array( 'engine' => 'TestAppCache' ));