Test to demonstrate issue with non-string paths in Hash::get

This commit is contained in:
Mark van Driel 2015-04-08 17:25:44 +02:00 committed by mark_story
parent 846c5f13ad
commit 900fd3e7e5

View file

@ -239,6 +239,25 @@ class HashTest extends CakeTestCase {
Hash::get(array('one' => 'two'), true);
}
/**
* Test testGetNonStringPath()
*
* @return void
*/
public function testGetNonStringPath() {
$result = Hash::get(array(1.1 => 'one.one'), 1.1);
$this->assertEquals('one.one', $result);
$result = Hash::get(array('1' => array('1' => 'one.one')), 1.1);
$this->assertNull($result);
$result = Hash::get(array(true => 'true'), true);
$this->assertEquals('true', $result);
$result = Hash::get(array('one' => 'two'), null, '-');
$this->assertEquals('-', $result);
}
/**
* Test dimensions.
*