Skip to content

Commit

Permalink
Added test case for a bug in Set::extract
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Story <mark@mark-story.com>
  • Loading branch information
Jimmy Bourassa authored and markstory committed Mar 25, 2010
1 parent 9d3f2fb commit e8e520d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cake/tests/cases/libs/set.test.php
Expand Up @@ -973,6 +973,20 @@ function testExtract() {
$result = Set::extract('/ParentNode/name', $hasMany);
$expected = array('Second');
$this->assertEqual($result, $expected);

$startingAtOne = array(
'Article' => array(
1=> array(
'id' => 1,
'approved' => 1,
),
)
);

$expected = array(0 => array('Article' => array('id' => 1, 'approved' => 1)));
$result = Set::extract('/Article[approved=1]', $startingAtOne);
$this->assertEqual($result, $expected);

}
/**
* test that extract() still works when arrays don't contain a 0 index.
Expand Down

0 comments on commit e8e520d

Please sign in to comment.