Fixed Doctrine_Node_NestedSet::getNumberChildren()
This commit is contained in:
parent
6d4f7da224
commit
ce90ee576a
@ -318,12 +318,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
|
|||||||
*/
|
*/
|
||||||
public function getNumberChildren()
|
public function getNumberChildren()
|
||||||
{
|
{
|
||||||
$count = 0;
|
return count($this->getChildren());
|
||||||
$children = $this->getChildren();
|
|
||||||
while ($children->next()) {
|
|
||||||
$count++;
|
|
||||||
}
|
|
||||||
return $count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,6 +72,13 @@ class Doctrine_NestedSet_SingleRoot_TestCase extends Doctrine_UnitTestCase
|
|||||||
$this->assertEqual('node2', $desc[0]['name']);
|
$this->assertEqual('node2', $desc[0]['name']);
|
||||||
$this->assertEqual(1, $desc[0]['level']);
|
$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()
|
public function testGetAncestors()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user