Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Moving failing test into new method for non-zero array extraction.
  • Loading branch information
markstory committed Mar 25, 2010
1 parent e8e520d commit cbb65ca
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions cake/tests/cases/libs/set.test.php
Expand Up @@ -973,20 +973,6 @@ 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 Expand Up @@ -1049,6 +1035,19 @@ function testExtractWithNonZeroArrays() {

$result = Set::extract('/User/id', $nonZero);
$this->assertEqual($result, $expected, 'Failed non zero array key extract');

$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);
}
/**
* testExtractWithArrays method
Expand Down

0 comments on commit cbb65ca

Please sign in to comment.