Commit ce90ee57 authored by romanb's avatar romanb

Fixed Doctrine_Node_NestedSet::getNumberChildren()

parent 6d4f7da2
......@@ -318,12 +318,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
*/
public function getNumberChildren()
{
$count = 0;
$children = $this->getChildren();
while ($children->next()) {
$count++;
}
return $count;
return count($this->getChildren());
}
/**
......
......@@ -72,6 +72,13 @@ class Doctrine_NestedSet_SingleRoot_TestCase extends Doctrine_UnitTestCase
$this->assertEqual('node2', $desc[0]['name']);
$this->assertEqual(1, $desc[0]['level']);
}
public function testGetNumberChildren()
{
$treeMngr = $this->conn->getTable('NestedSetTest_SingleRootNode')->getTree();
$root = $treeMngr->fetchRoot();
$this->assertEqual(1, $root->getNode()->getNumberChildren());
}
public function testGetAncestors()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment