Skip to content

Commit

Permalink
Fixing incorrect optional parameters passed to TreeBehavior::children…
Browse files Browse the repository at this point in the history
…() in TreeBehavior test case. Fixes errors & test failures when running under PHP 5.3.
  • Loading branch information
jperras committed Sep 10, 2009
1 parent 115ae3f commit c48d979
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cake/tests/cases/libs/model/behaviors/tree.test.php
Expand Up @@ -1128,12 +1128,12 @@ function testNoAmbiguousColumn() {
$data = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
$this->Tree->id= $data[$modelClass]['id'];

$direct = $this->Tree->children(null, true, array('id', 'name', $parentField, $leftField, $rightField), null, null, null, 1);
$direct = $this->Tree->children(null, true, array('id', 'name', $parentField, $leftField, $rightField));
$expects = array(array($modelClass => array('id' => 2, 'name' => '1.1', $parentField => 1, $leftField => 2, $rightField => 7)),
array($modelClass => array('id' => 5, 'name' => '1.2', $parentField => 1, $leftField => 8, $rightField => 13)));
$this->assertEqual($direct, $expects);

$total = $this->Tree->children(null, null, array('id', 'name', $parentField, $leftField, $rightField), null, null, null, 1);
$total = $this->Tree->children(null, null, array('id', 'name', $parentField, $leftField, $rightField));
$expects = array(
array($modelClass => array('id' => 2, 'name' => '1.1', $parentField => 1, $leftField => 2, $rightField => 7)),
array($modelClass => array('id' => 3, 'name' => '1.1.1', $parentField => 2, $leftField => 3, $rightField => 4)),
Expand Down Expand Up @@ -1717,7 +1717,7 @@ function testChildren() {
$this->Tree->initialize(2, 2);

$data = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
$this->Tree->id= $data[$modelClass]['id'];
$this->Tree->id = $data[$modelClass]['id'];

$direct = $this->Tree->children(null, true, array('name', $leftField, $rightField));
$expects = array(array($modelClass => array('name' => '1.1', $leftField => 2, $rightField => 7)),
Expand All @@ -1742,19 +1742,20 @@ function testChildren() {
function testNoAmbiguousColumn() {
extract($this->settings);
$this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2);

$this->Tree->bindModel(array('belongsTo' => array('Dummy' =>
array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false);
$this->Tree->initialize(2, 2);

$data = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
$this->Tree->id= $data[$modelClass]['id'];
$this->Tree->id = $data[$modelClass]['id'];

$direct = $this->Tree->children(null, true, array('name', $leftField, $rightField), null, null, null, 1);
$direct = $this->Tree->children(null, true, array('name', $leftField, $rightField));
$expects = array(array($modelClass => array('name' => '1.1', $leftField => 2, $rightField => 7)),
array($modelClass => array('name' => '1.2', $leftField => 8, $rightField => 13)));
$this->assertEqual($direct, $expects);

$total = $this->Tree->children(null, null, array('name', $leftField, $rightField), null, null, null, 1);
$total = $this->Tree->children(null, null, array('name', $leftField, $rightField));
$expects = array(
array($modelClass => array('name' => '1.1', $leftField => 2, $rightField => 7)),
array($modelClass => array('name' => '1.1.1', $leftField => 3, $rightField => 4)),
Expand Down

0 comments on commit c48d979

Please sign in to comment.