Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ticket #989 test case added

  • Loading branch information...
commit 9cb31bf86ce8de61efa25fe1bb9a25d9d40e59d7 1 parent 268b0dc
Rifat Nabi torifat authored markstory committed
Showing with 34 additions and 0 deletions.
  1. +34 −0 cake/tests/cases/libs/set.test.php
34 cake/tests/cases/libs/set.test.php
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.