Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed Configure::write to return true on success. Maked testing res…

…ult simpler.
  • Loading branch information...
commit 382e11ccde9d37b002728d5c3f5247c063fd2218 1 parent 174108d
@predominant predominant authored
View
3  cake/libs/configure.php
@@ -75,7 +75,7 @@ function &getInstance($boot = true) {
* @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 @@ function write($config, $value = null) {
}
error_reporting($reporting);
}
+ return true;
}
/**
View
15 cake/tests/cases/libs/configure.test.php
@@ -108,16 +108,19 @@ function testRead() {
* @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 @@ function testLoad() {
$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 @@ function testLoad() {
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);
Please sign in to comment.
Something went wrong with that request. Please try again.