$t->info(' Set absolute=>true on the url options and use the "route" format.'); $menu->setRoute('homepage'); $menu->setUrlOptions(array('absolute' => true)); $t->is($menu->renderLink(), '<a href="' . url_for('@homepage', true) . '?test=1">root</a>', '->renderLink() properly uses the url option to render absolutely.'); // replace settings $menu->setLinkOptions(array()); $menu->setUrlOptions(array()); $menu->setRoute(null); $t->info('7 - Test some "intangible" functions (e.g. callRecursively()).'); $t->info(' 7.1 - Test callRecursively()'); $otherMenu = new ioMenuItem('other'); $otherMenu->addChild('child'); $otherMenu['child']->addChild('grandchild'); $t->info(' Call ->setLabel() recursively.'); $otherMenu->callRecursively('setLabel', 'changed'); $t->is($otherMenu->getLabel(), 'changed', 'The label was changed at the root.'); $t->is($otherMenu['child']->getLabel(), 'changed', 'The label was changed on the child.'); $t->is($otherMenu['child']['grandchild']->getLabel(), 'changed', 'The label was changed on the grandchild.'); $t->info(' 7.2 - Test getPathAsString()'); $t->is($gc1->getPathAsString('---'), 'root---Parent 2---Child 4---Grandchild 1', '->getPathAsString() returns the correct string path for gc1.'); $t->info(' 7.3 - Test getBreadcrumbsArray()'); $breadcrumbsMenu = new ioMenuItem('Home', 'http://www.sympalphp.org'); $breadcrumbsMenu->addChild('Reference Manual', 'http://www.sympalphp.org/documentation/1_0/book/en'); $breadcrumbsMenu['Reference Manual']->addChild('Introduction', 'http://www.sympalphp.org/documentation/1_0/book/introduction/en'); $breadcrumbs1 = array('Home' => 'http://www.sympalphp.org'); $breadcrumbs2 = array('Home' => 'http://www.sympalphp.org', 'Reference Manual' => 'http://www.sympalphp.org/documentation/1_0/book/en'); $breadcrumbs3 = array('Home' => 'http://www.sympalphp.org', 'Reference Manual' => 'http://www.sympalphp.org/documentation/1_0/book/en', 'Introduction' => 'http://www.sympalphp.org/documentation/1_0/book/introduction/en'); $t->is($breadcrumbsMenu->getBreadcrumbsArray(), $breadcrumbs1, '->getBreadcrumbsMenu() on the root returns the correct array.'); $t->is($breadcrumbsMenu['Reference Manual']->getBreadcrumbsArray(), $breadcrumbs2, '->getBreadcrumbsMenu() on the child returns the correct array.'); $t->is($breadcrumbsMenu['Reference Manual']['Introduction']->getBreadcrumbsArray(), $breadcrumbs3, '->getBreadcrumbsMenu() on the grandchild returns the correct array.'); $t->is($breadcrumbsMenu->getBreadcrumbsArray('test'), array('Home' => 'http://www.sympalphp.org', 'test' => null), '->getBreadcrumbsArray() with a string parameter adds one entry to the array.');