{ // resets the isCurrent property so we can test for current repeatedly. public function resetIsCurrent() { $this->_isCurrent = null; } // resets the userAccess property so we can test for current repeatedly. public function resetUserAccess() { $this->_userAccess = null; } } $t->info('1 - Test basic getters, setters and constructor'); $menu = new ioMenuItem('test menu', '@homepage', array('title' => 'my menu')); $t->is($menu->getName(), 'test menu', '->getName() returns the given name.'); $menu->setName('new menu name'); $t->is($menu->getName(), 'new menu name', '->setName() sets the name correctly.'); $t->is($menu->getLabel(), 'new menu name', '->getLabel() returns the name if the label does not exist.'); $menu->setLabel('menu label'); $t->is($menu->getLabel(), 'menu label', 'Once set, ->getLabel() returns the actual label.'); $t->is($menu->getRoute(), '@homepage', '->getRoute() returns the given route.'); $menu->setRoute('http://www.sympalphp.org'); $t->is($menu->getRoute(), 'http://www.sympalphp.org', '->setRoute() sets the route correctly.'); $t->is($menu->getAttributes(), array('title' => 'my menu'), '->getAttributes() returns the attributes array.'); $menu->setAttributes(array('id' => 'unit_test')); $t->is($menu->getAttributes(), array('id' => 'unit_test'), '->setAttributes() sets the attributes array.'); $t->is($menu->getAttribute('id', 'default'), 'unit_test', '->getAttribute() returns an existing attribute correctly.'); $t->is($menu->getAttribute('fake', 'default'), 'default', '->getAttribute() returns the default for a non-existent attribute.'); $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.');