Fixing formatting, and updating test to better reflect what would normally happen.

This commit is contained in:
mark_story 2011-04-16 15:56:40 -04:00
parent 13c64f1707
commit 4395e8acc1
2 changed files with 6 additions and 3 deletions

View file

@ -281,8 +281,8 @@ class CookieComponent extends Object {
$this->read();
}
if (strpos($key, '.') === false) {
if(isset($this->__values[$key]) && is_array($this->__values[$key])) {
foreach($this->__values[$key] as $idx => $val) {
if (isset($this->__values[$key]) && is_array($this->__values[$key])) {
foreach ($this->__values[$key] as $idx => $val) {
$this->__delete("[$key][$idx]");
}
} else {

View file

@ -456,7 +456,10 @@ class CookieComponentTest extends CakeTestCase {
* @return void
*/
function testDeleteRemovesChildren() {
$_COOKIE['CakeTestCookie'] = array('User' => array('email' => 'example@example.com', 'name' => 'mark'));
$_COOKIE['CakeTestCookie'] = array(
'User' => array('email' => 'example@example.com', 'name' => 'mark'),
'other' => 'value'
);
$this->Controller->Cookie->startup();
$this->assertEqual('mark', $this->Controller->Cookie->read('User.name'));