/**
  * @test
  */
 public function it_checks_if_a_menu_url_is_the_same_as_the_current_path()
 {
     $menu = new MenuItem('menu1', '/path');
     $selector1 = new SimpleUrlSelector('http://test.com/path');
     $selector2 = new SimpleUrlSelector('http://test.com/path2');
     $this->assertTrue($selector1->isSelected($menu));
     $this->assertFalse($selector2->isSelected($menu));
 }
Example #2
0
 public function isSelected(MenuItem $menu)
 {
     $selected = parent::isSelected($menu);
     if (!$selected) {
         $checkers = array($this->linked_urls_checker, $this->linked_actions_checker, $this->linked_routes_checker);
         foreach ($checkers as $checker) {
             if ($checker) {
                 if ($selected = $checker->isLinked($menu)) {
                     break;
                 }
             }
         }
     }
     return $selected;
 }