public function setTree(array $tree = null)
{
$this->tree = null !== $tree ? $tree : array();
return $this;
}
public function testAddBranch() { $tree = array(array('name' => 'First Nav Item', 'href' => '/first')); $branch = array('name' => 'Second Nav Item', 'href' => '/second'); $n = new Nav(); $n->setTree($tree); $n->addBranch($branch); $t = $n->getTree(); $this->assertEquals('Second Nav Item', $t[1]['name']); }