Port changes done to Set into Hash

See #2722
This commit is contained in:
mark_story 2012-03-26 22:39:13 -04:00
parent 6e0e15682f
commit c087576f20
2 changed files with 23 additions and 1 deletions

View file

@ -1113,6 +1113,28 @@ class HashTest extends CakeTestCase {
$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'
)
);
$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.
*

View file

@ -270,7 +270,7 @@ class Hash {
$_list =& $_list[$key];
}
if (!is_array($_list)) {
return array();
$_list = array();
}
}
if ($op === 'remove') {