/** * testAdminMenus */ public function testAdminMenus() { CakeSession::write('Auth.User', array('id' => 1, 'role_id' => 1)); CroogoNav::add('contents', array('title' => 'Contents', 'url' => '#')); $items = CroogoNav::items(); $expected = '<ul class="nav nav-stacked"><li><a href="#" class="menu-contents sidebar-item"><i class="icon-white icon-large"></i> <span>Contents</span></a></li></ul>'; $result = $this->Croogo->adminMenus(CroogoNav::items()); $this->assertEquals($expected, $result); }
public function testNavOverwrite() { $defaults = CroogoNav::getDefaults(); $items = CroogoNav::items(); $expected = Hash::merge($defaults, array('title' => 'Permissions', 'url' => array('admin' => true, 'plugin' => 'acl', 'controller' => 'acl_permissions', 'action' => 'index'), 'weight' => 30)); $this->assertEquals($expected, $items['users']['children']['permissions']); $item = array('title' => 'Permissions', 'url' => array('admin' => true, 'plugin' => 'acl_extras', 'controller' => 'acl_extras_permissions', 'action' => 'index'), 'weight' => 30); CroogoNav::add('users.children.permissions', $item); $items = CroogoNav::items(); $expected = Hash::merge($defaults, array('title' => 'Permissions', 'url' => array('admin' => true, 'plugin' => 'acl_extras', 'controller' => 'acl_extras_permissions', 'action' => 'index'), 'weight' => 30)); $this->assertEquals($expected, $items['users']['children']['permissions']); }