Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added test case for a bug in Set::extract

Signed-off-by: Mark Story <mark@mark-story.com>
  • Loading branch information...
commit e8e520d6f2114b2e954299ca95e7360f4d191535 1 parent 9d3f2fb
Jimmy Bourassa authored markstory committed
Showing with 14 additions and 0 deletions.
  1. +14 −0 cake/tests/cases/libs/set.test.php
View
14 cake/tests/cases/libs/set.test.php
@@ -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.
Please sign in to comment.
Something went wrong with that request. Please try again.