Skip to content

Commit

Permalink
Port changes done to Set into Hash
Browse files Browse the repository at this point in the history
See #2722
  • Loading branch information
markstory committed Mar 27, 2012
1 parent 6e0e156 commit c087576
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions lib/Cake/Test/Case/Utility/HashTest.php
Expand Up @@ -1113,6 +1113,28 @@ public function testInsertMulti() {
$this->assertEquals('value', $result[0]['Comment'][1]['insert']);
}

/**
* Test that insert() can insert data over a string value.
*
* @return void
*/
public function testInsertOverwriteStringValue() {
$data = array(
'Some' => array(
'string' => 'value'
)
);

This comment has been minimized.

Copy link
@hiromi2424

hiromi2424 Mar 30, 2012

Set -> Hash?

This comment has been minimized.

Copy link
@lorenzo

lorenzo Mar 30, 2012

Member

He's cheating!

This comment has been minimized.

Copy link
@markstory

markstory Mar 31, 2012

Author Member

Good catch @hiromi2424 fixed in [a463033]

$result = Set::insert($data, 'Some.string.value', array('values'));
$expected = array(
'Some' => array(
'string' => array(
'value' => array( 'values')
)
)
);
$this->assertEquals($expected, $result);
}

/**
* Test remove() method.
*
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Utility/Hash.php
Expand Up @@ -270,7 +270,7 @@ protected static function _simpleOp($op, $data, $path, $values = null) {
$_list =& $_list[$key];
}
if (!is_array($_list)) {
return array();
$_list = array();
}
}
if ($op === 'remove') {
Expand Down

0 comments on commit c087576

Please sign in to comment.