Skip to content

Commit

Permalink
ticket #989 test case added
Browse files Browse the repository at this point in the history
  • Loading branch information
torifat authored and markstory committed Apr 28, 2011
1 parent 268b0dc commit 9cb31bf
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions cake/tests/cases/libs/set.test.php
Expand Up @@ -902,6 +902,40 @@ function testExtract() {
$result = Set::extract('/ParentNode/name', $hasMany);
$expected = array('Second');
$this->assertEqual($result, $expected);

$data = array(
array(
'Category' => array(
'id' => 1,
'name' => 'First'
),
0 => array(
'value' => 50
)
),
array(
'Category' => array(
'id' => 2,
'name' => 'Second'
),
0 => array(
'value' => 60
)
)
);
$expected = array(
array(
'Category' => array(
'id' => 1,
'name' => 'First'
),
0 => array(
'value' => 50
)
)
);
$result = Set::extract('/Category[id=1]/..', $data);
$this->assertEqual($result, $expected);
}
/**
* test parent selectors with extract
Expand Down

0 comments on commit 9cb31bf

Please sign in to comment.