public function testAcceptAclShouldReturnGracefullyWithUnknownResource() { // setup $acl = $this->_getAcl(); $this->_helper->setAcl($acl['acl']); $this->_helper->setRole($acl['role']); $accepted = $this->_helper->accept(new \Zend\Navigation\Page\Uri(array('resource' => 'unknownresource', 'privilege' => 'someprivilege'), false)); $this->assertEquals($accepted, false); }
/** * @param AbstractPage[] $container * @param NavigationHelper $navigation * * @return string */ protected function drawBootstrapNavigationProfile($container, $navigation) { switch ($this->level) { case 0: $navigationClass = 'nav navbar-nav navbar-right navbar-profile'; $template = "<ul class='{$navigationClass}'>"; break; default: $navigationClass = 'dropdown-menu'; $template = "<ul class='{$navigationClass}'>"; $template .= "<li class='navigation-li-username visible-sm-block visible-md-block visible-lg-block'>{$this->userName}</li>"; $template .= "<li class='divider'></li>"; } foreach ($container as $page) { if (!$page->isVisible() || !$navigation->accept($page)) { continue; } $hasChildren = $page->hasPages(); // Add Navigation Headings if ($this->checkForHeading($page->getLabel(), $template)) { continue; } // Add Navigation Separators if ($this->checkForSeparator($page->getLabel(), $template)) { continue; } $this->userName = $page->getLabel(); $liParams = $this->level ? '' : " id='fat-menu' class='dropdown profile-menu'"; $aParams = $this->level ? '' : " id='drop-profile' class='dropdown-toggle profile-menu-cover' data-toggle='dropdown'"; $additional = $this->level ? '' : "<img class='navigation-avatar' src='{$page->get('icon')}'> <span class='visible-xs-inline-block navigation-xs-username'>{$this->userName}</span>"; if (!$hasChildren) { if ($page->getLabel() == 'lampushka') { $template .= "<li{$liParams}><a tabindex='-1' href='#'{$aParams} id='submit-idea'>Give Feedback <span class='submit-idea-icon'></span></a></li>"; } elseif ($page->getLabel() == 'Lunchroom') { $venueService = $this->serviceManager->getServiceLocator()->get('service_venue_venue'); if ($venueService->thereIsLunchroomInUserCityThatExceptOrders()) { $template .= "<li{$liParams}><a tabindex='-1' href='{$page->getHref()}'{$aParams}>{$page->getLabel()}</a></li>"; } } else { $template .= "<li{$liParams}><a tabindex='-1' href='{$page->getHref()}'{$aParams}>{$page->getLabel()}</a></li>"; } } else { $template .= "<li{$liParams}><a tabindex='-1' href='#'{$aParams}>{$additional}</a>"; $this->level++; $template .= $this->drawBootstrapNavigationProfile($page->getPages(), $navigation); $this->level--; $template .= '</li>'; } } $template .= '</ul>'; return $template; }