Added test case for a bug in Set::extract

Signed-off-by: Mark Story <mark@mark-story.com>
This commit is contained in:
Jimmy Bourassa 2010-03-17 00:09:27 -04:00 committed by Mark Story
parent 9d3f2fb4a7
commit e8e520d6f2

View file

@ -973,6 +973,20 @@ class SetTest extends CakeTestCase {
$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.