/** * @test */ public function shouldCreateCorrectUrlWithExtraParams() { //given $defaults = Config::getValue('global'); //when $url = ControllerUrl::createUrl(array('controller' => 'users', 'action' => 'add', 'extraParams' => array('id' => 5, 'name' => 'john'))); //then $this->assertEquals($defaults['prefix_system'] . '/users/add/id/5/name/john', $url); }
public static function showBreadcrumbs($options = array()) { $options['class'] = isset($options['class']) ? $options['class'] : 'breadcrumb'; $attr = self::_prepareAttributes($options); $breadcrumbs = '<ol ' . $attr . '>'; $breadcrumbsMap = Breadcrumb::getBreadcrumbs(); foreach ($breadcrumbsMap as $breadcrumb) { $name = $breadcrumb->getName(); $attribute = ''; if (end($breadcrumbsMap) === $breadcrumb) { $attribute = 'class="active"'; } else { $url = ControllerUrl::createUrl(array('string' => $breadcrumb->getPath())); $name = '<a href="' . $url . '">' . $breadcrumb->getName() . '</a>'; } $breadcrumbs .= ' <li ' . $attribute . '>' . $name . '</li> '; } $breadcrumbs .= '</ol> '; return $breadcrumbs; }
function url($params) { return ControllerUrl::createUrl($params); }