Skip to content

Commit

Permalink
merge by default
Browse files Browse the repository at this point in the history
  • Loading branch information
AD7six committed Mar 27, 2014
1 parent 08a6faf commit 7917fd7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Core/InstanceConfigTrait.php
Expand Up @@ -68,10 +68,10 @@ trait InstanceConfigTrait {
* @param string|array|null $key the key to get/set, or a complete array of configs
* @param mixed|null $value the value to set
* @return mixed|null null for write, or whatever is in the config on read
* @param bool $merge whether to merge or overwrite existing config
* @param bool $merge whether to merge or overwrite existing config defaults to true
* @throws \Cake\Error\Exception When trying to set a key that is invalid
*/
public function config($key = null, $value = null, $merge = false) {
public function config($key = null, $value = null, $merge = true) {
if (!$this->_configInitialized) {
$this->_config = $this->_defaultConfig;
$this->_configInitialized = true;
Expand Down
10 changes: 5 additions & 5 deletions tests/TestCase/Core/InstanceConfigTraitTest.php
Expand Up @@ -270,7 +270,7 @@ public function testSetClobber() {
* @return void
*/
public function testMerge() {
$this->object->config(['a' => ['nother' => 'value']], null, true);
$this->object->config(['a' => ['nother' => 'value']]);

$this->assertSame(
[
Expand All @@ -291,7 +291,7 @@ public function testMerge() {
* @return void
*/
public function testMergeDotKey() {
$this->object->config('a.nother', 'value', true);
$this->object->config('a.nother', 'value');

$this->assertSame(
[
Expand All @@ -305,7 +305,7 @@ public function testMergeDotKey() {
'Should act the same as having passed the equivalent array to the config function'
);

$this->object->config(['a.nextra' => 'value'], null, true);
$this->object->config(['a.nextra' => 'value']);

$this->assertSame(
[
Expand All @@ -327,7 +327,7 @@ public function testMergeDotKey() {
* @return void
*/
public function testSetDefaultsMerge() {
$this->object->config(['a' => ['nother' => 'value']], null, true);
$this->object->config(['a' => ['nother' => 'value']]);

$this->assertSame(
[
Expand Down Expand Up @@ -371,7 +371,7 @@ public function testSetDefaultsNoMerge() {
* @return void
*/
public function testSetMergeNoClobber() {
$this->object->config(['a.nested.value' => 'it is possible'], null, true);
$this->object->config(['a.nested.value' => 'it is possible']);

$this->assertSame(
[
Expand Down

0 comments on commit 7917fd7

Please sign in to comment.