Permalink
Browse files

Port changes done to Set into Hash

See #2722
  • Loading branch information...
1 parent 6e0e156 commit c087576f2071503e725fbbfa4fe551b7a9feb9a7 @markstory markstory committed Mar 27, 2012
Showing with 23 additions and 1 deletion.
  1. +22 −0 lib/Cake/Test/Case/Utility/HashTest.php
  2. +1 −1 lib/Cake/Utility/Hash.php
@@ -1114,6 +1114,28 @@ public function testInsertMulti() {
}
/**
+ * 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'));
hiromi2424
hiromi2424 Mar 30, 2012 Contributor

Set -> Hash?

lorenzo
lorenzo Mar 30, 2012 Owner

He's cheating!

markstory
markstory Mar 31, 2012 Owner

Good catch @hiromi2424 fixed in [a463033]

+ $expected = array(
+ 'Some' => array(
+ 'string' => array(
+ 'value' => array( 'values')
+ )
+ )
+ );
+ $this->assertEquals($expected, $result);
+ }
+
+/**
* Test remove() method.
*
* @return void
@@ -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') {

0 comments on commit c087576

Please sign in to comment.