Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ticket #989 test case added
  • Loading branch information
torifat committed Apr 27, 2011
1 parent 7812223 commit 03ffa3d
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 @@ -939,6 +939,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);
}

/**
Expand Down

0 comments on commit 03ffa3d

Please sign in to comment.