$menu->setAttribute('class', 'testing classes'); $t->is($menu->getAttribute('class'), 'testing classes', '->setAttribute() correctly sets an attribute.'); $t->is($menu->requiresAuth(), false, 'By default ->requiresAuth() returns false.'); $menu->requiresAuth(true); $t->is($menu->requiresAuth(), true, 'Calling ->requiresAuth() with an argument sets the property.'); $t->is($menu->requiresNoAuth(), false, 'By default ->requiresNoAuth() returns false.'); $menu->requiresNoAuth(true); $t->is($menu->requiresNoAuth(), true, 'Calling ->requiresNoAuth() with an argument sets the property.'); $menu->setCredentials(array('c1', 'c2')); $t->is($menu->getCredentials(), array('c1', 'c2'), '->setCredentials() with an array sets all of the given credentials.'); $t->is($menu->showChildren(), true, '->showChildren() return true by default.'); $menu->showChildren(false); $t->is($menu->showChildren(), false, '->showChildren() with an argument properly sets the property.'); $childMenu = new ioMenuItem('child'); $childMenu->setParent($menu); $t->is($childMenu->getParent(), $menu, '->setParent() sets the parent menu item.'); $t->is(count($menu->getChildren()), 0, '->getChildren() returns no children to start.'); $menu->setChildren(array($childMenu)); $t->is($menu->getChildren(), array($childMenu), '->getChildren() returns the proper children array.'); $menu->setNum(5); $t->is($menu->getNum(), 5, '->setNum() sets the num property.'); $t->info('### Creating the test tree.'); // create the tree and make the variables available extract(create_test_tree($t, 'ioMenuItemTest')); $t->info('2 - Test the construction of trees'); check_test_tree($t, $menu); print_test_tree($t); // print the test tree $t->is(get_class($pt1), 'ioMenuItemTest', 'Test that children menu items are created as same class as parent.'); // basic hierarchy functions $t->info(' 2.1 - Test the basics of the hierarchy.');