Merge branch '2.1' into 2.2

This commit is contained in:
mark_story 2012-03-26 22:24:30 -04:00
commit 6b045318d8
5 changed files with 40 additions and 3 deletions

2
.gitignore vendored
View file

@ -6,4 +6,4 @@
/build /build
/dist /dist
.DS_Store .DS_Store
tags /tags

View file

@ -191,7 +191,6 @@ class SessionComponentTest extends CakeTestCase {
$this->assertTrue($Session->write('Test', 'some value')); $this->assertTrue($Session->write('Test', 'some value'));
$this->assertEquals('some value', $Session->read('Test')); $this->assertEquals('some value', $Session->read('Test'));
$this->assertFalse($Session->write('Test.key', 'some value'));
$Session->delete('Test'); $Session->delete('Test');
$this->assertTrue($Session->write('Test.key.path', 'some value')); $this->assertTrue($Session->write('Test.key.path', 'some value'));

View file

@ -297,6 +297,22 @@ class CakeSessionTest extends CakeTestCase {
$this->assertFalse(TestCakeSession::write('')); $this->assertFalse(TestCakeSession::write(''));
} }
/**
* Test overwriting a string value as if it were an array.
*
* @return void
*/
public function testWriteOverwriteStringValue() {
TestCakeSession::write('Some.string', 'value');
$this->assertEquals('value', TestCakeSession::read('Some.string'));
TestCakeSession::write('Some.string.array', array('values'));
$this->assertEquals(
array('values'),
TestCakeSession::read('Some.string.array')
);
}
/** /**
* testId method * testId method
* *

View file

@ -1700,6 +1700,28 @@ class SetTest extends CakeTestCase {
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
} }
/**
* 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);
}
/** /**
* testRemove method * testRemove method
* *

View file

@ -686,7 +686,7 @@ class Set {
$_list =& $_list[$key]; $_list =& $_list[$key];
} }
if (!is_array($_list)) { if (!is_array($_list)) {
return array(); $_list = array();
} }
} }
return $list; return $list;