From 382e11ccde9d37b002728d5c3f5247c063fd2218 Mon Sep 17 00:00:00 2001 From: predominant Date: Thu, 4 Mar 2010 10:20:15 +1100 Subject: [PATCH] Changed Configure::write to return true on success. Maked testing result simpler. --- cake/libs/configure.php | 3 ++- cake/tests/cases/libs/configure.test.php | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cake/libs/configure.php b/cake/libs/configure.php index 8629eb1e4..40f9b0041 100644 --- a/cake/libs/configure.php +++ b/cake/libs/configure.php @@ -75,7 +75,7 @@ class Configure extends Object { * @link http://book.cakephp.org/view/412/write * @param array $config Name of var to write * @param mixed $value Value to set for var - * @return void + * @return boolean True if write was successful * @access public */ function write($config, $value = null) { @@ -133,6 +133,7 @@ class Configure extends Object { } error_reporting($reporting); } + return true; } /** diff --git a/cake/tests/cases/libs/configure.test.php b/cake/tests/cases/libs/configure.test.php index 457d38773..67104dcf6 100644 --- a/cake/tests/cases/libs/configure.test.php +++ b/cake/tests/cases/libs/configure.test.php @@ -108,16 +108,19 @@ class ConfigureTest extends CakeTestCase { * @return void */ function testWrite() { - Configure::write('SomeName.someKey', 'myvalue'); + $writeResult = Configure::write('SomeName.someKey', 'myvalue'); + $this->assertTrue($writeResult); $result = Configure::read('SomeName.someKey'); $this->assertEqual($result, 'myvalue'); - Configure::write('SomeName.someKey', null); + $writeResult = Configure::write('SomeName.someKey', null); + $this->assertTrue($writeResult); $result = Configure::read('SomeName.someKey'); $this->assertEqual($result, null); $expected = array('One' => array('Two' => array('Three' => array('Four' => array('Five' => 'cool'))))); - Configure::write('Key', $expected); + $writeResult = Configure::write('Key', $expected); + $this->assertTrue($writeResult); $result = Configure::read('Key'); $this->assertEqual($expected, $result); @@ -226,7 +229,7 @@ class ConfigureTest extends CakeTestCase { $this->assertFalse($result); $result = Configure::load('config'); - $this->assertTrue($result === null); + $this->assertTrue($result); $result = Configure::load('../../index'); $this->assertFalse($result); @@ -241,13 +244,13 @@ class ConfigureTest extends CakeTestCase { function testLoadPlugin() { App::build(array('plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)), true); $result = Configure::load('test_plugin.load'); - $this->assertTrue($result === null); + $this->assertTrue($result); $expected = '/test_app/plugins/test_plugin/config/load.php'; $config = Configure::read('plugin_load'); $this->assertEqual($config, $expected); $result = Configure::load('test_plugin.more.load'); - $this->assertTrue($result === null); + $this->assertTrue($result); $expected = '/test_app/plugins/test_plugin/config/more.load.php'; $config = Configure::read('plugin_more_load'); $this->assertEqual($config, $expected);