Skip to content

Commit

Permalink
Add tests for #2433
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 9, 2013
1 parent 764e368 commit edcfe2d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/Cake/Test/Case/Utility/HashTest.php
Expand Up @@ -828,6 +828,26 @@ public function testExtractAttributeEquality() {
$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.
*
Expand Down

0 comments on commit edcfe2d

Please sign in to comment.