Example #1
0
 /**
  * Loads RouteCollection from source
  *
  * @param   string      $source   Path to resource
  * @return  RouteCollection
  */
 public function loadRouteCollection($source = null)
 {
     $collection = new RouteCollection();
     $routes = $this->loadResource($source);
     foreach ($routes as $name => $route) {
         $collection->add($name, $this->parseRoute($route));
     }
     return $collection;
 }
 public function testAll()
 {
     $routeCollection = new RouteCollection();
     $expected = array();
     $routes = array($route1 = new Route('/', array('GET'), 'Orders', 'getAll'), $route2 = new Route('/products', array('GET', 'POST'), 'Producs', 'get'), $route3 = new Route(null, array('PUT'), 'Home', 'getHome'));
     foreach ($routes as $route) {
         $routeCollection->add($route->getCalls(), $route);
         $expected[$route->getCalls()] = $route;
     }
     $this->assertSame($routeCollection->all(), $expected);
 }