Add tests for #2433

This commit is contained in:
mark_story 2013-12-09 12:17:25 -05:00
parent 764e368dc3
commit edcfe2d3a8

View file

@ -828,6 +828,26 @@ class HashTest extends CakeTestCase {
$this->assertEquals(5, $result[3]['id']);
}
/**
* Test that attribute matchers don't cause errors on scalar data.
*
* @return void
*/
public function testExtractAttributeEqualityOnScalarValue() {
$data = array(
'Entity' => array(
'id' => 1 ,
'data1' => 'value',
)
);
$result = Hash::extract($data, 'Entity[id=1].data1');
$this->assertEquals(array('value'), $result);
$data = array('Entity' => false );
$result = Hash::extract($data, 'Entity[id=1].data1');
$this->assertEquals(array(), $result);
}
/**
* Test comparison operators.
*