Permalink
Browse files

casting the find as an array to avoid errors with array_values() fixes

…#1041 and 4 failing tests (3 previous)

Signed-off-by: mark_story <mark@mark-story.com>
  • Loading branch information...
1 parent 0d4a500 commit 2809e3cedfee6a7a2b271e45a38e3faaee7d8614 @dogmatic69 dogmatic69 committed with markstory Aug 24, 2010
Showing with 4 additions and 2 deletions.
  1. +1 −1 cake/libs/model/behaviors/tree.php
  2. +3 −1 cake/tests/cases/libs/model/behaviors/tree.test.php
@@ -276,7 +276,7 @@ function children(&$Model, $id = null, $direct = false, $fields = null, $order =
if (!$id) {
$conditions = $scope;
} else {
- $result = array_values($Model->find('first', array(
+ $result = array_values((array)$Model->find('first', array(
'conditions' => array($scope, $Model->escapeField() => $id),
'fields' => array($left, $right),
'recursive' => $recursive
@@ -1052,6 +1052,8 @@ function testChildren() {
array($modelClass => array( 'id' => 6, 'name' => '1.2.1', $parentField => 5, $leftField => 9, $rightField => 10)),
array($modelClass => array('id' => 7, 'name' => '1.2.2', $parentField => 5, $leftField => 11, $rightField => 12)));
$this->assertEqual($total, $expects);
+
+ $this->assertEqual(array(), $this->Tree->children(10000));
}
/**
* testCountChildren method
@@ -1802,4 +1804,4 @@ function testGenerateTreeListWithSelfJoin() {
$this->assertIdentical(array_values($result), $expected);
}
}
-?>
+?>

0 comments on commit 2809e3c

Please sign in to comment.