Exemplo n.º 1
0
 /**
  * Adds a route collection to the current set of routes (at the end of the current set).
  *
  * @param RouteCollection $collection A RouteCollection instance
  * @param string          $prefix     An optional prefix to add before each pattern of the route collection
  */
 public function addCollection(RouteCollection $collection, $prefix = '')
 {
     $collection->addPrefix($prefix);
     foreach ($collection->getResources() as $resource) {
         $this->addResource($resource);
     }
     $this->routes = array_merge($this->routes, $collection->getRoutes());
 }
 public function testAddRedirect()
 {
     $routes = new RouteCollection();
     $routes->addRedirect('users', 'Users::index', 307);
     $expected = ['users' => '\\Users::index'];
     $this->assertEquals($expected, $routes->getRoutes());
     $this->assertTrue($routes->isRedirect('users'));
     $this->assertEquals(307, $routes->getRedirectCode('users'));
 }