working on the route class.
This commit is contained in:
@@ -58,7 +58,7 @@ class Route {
|
|||||||
// Extract each URI from the route key. Since the route key has the request
|
// Extract each URI from the route key. Since the route key has the request
|
||||||
// method, we will extract that from the string. If the URI points to the
|
// method, we will extract that from the string. If the URI points to the
|
||||||
// root of the application, a single forward slash will be returned.
|
// root of the application, a single forward slash will be returned.
|
||||||
$uris = array_get($action, 'handles', array());
|
$uris = array_get($action, 'handles', array($key));
|
||||||
|
|
||||||
$this->uris = array_map(array($this, 'extract'), $uris);
|
$this->uris = array_map(array($this, 'extract'), $uris);
|
||||||
|
|
||||||
|
|||||||
@@ -200,8 +200,6 @@ class Router {
|
|||||||
|
|
||||||
$action = array('uses' => Bundle::prefix($bundle).'home@index');
|
$action = array('uses' => Bundle::prefix($bundle).'home@index');
|
||||||
|
|
||||||
$action['handles'] = array($destination);
|
|
||||||
|
|
||||||
return new Route($method.' '.$uri, $action);
|
return new Route($method.' '.$uri, $action);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,8 +243,6 @@ class Router {
|
|||||||
|
|
||||||
$action = array('uses' => $prefix.$controller.'@'.$method);
|
$action = array('uses' => $prefix.$controller.'@'.$method);
|
||||||
|
|
||||||
$action['handles'] = array($destination);
|
|
||||||
|
|
||||||
return new Route($destination, $action, $segments);
|
return new Route($destination, $action, $segments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,10 @@ class RouteTest extends PHPUnit_Framework_TestCase {
|
|||||||
{
|
{
|
||||||
$route = new Laravel\Routing\Route('GET /', array('handles' => array('GET /foo/bar')));
|
$route = new Laravel\Routing\Route('GET /', array('handles' => array('GET /foo/bar')));
|
||||||
|
|
||||||
|
$this->assertFalse($route->handles('/'));
|
||||||
|
$this->assertFalse($route->handles('baz'));
|
||||||
$this->assertTrue($route->handles('foo/*'));
|
$this->assertTrue($route->handles('foo/*'));
|
||||||
$this->assertTrue($route->handles('foo/bar'));
|
$this->assertTrue($route->handles('foo/bar'));
|
||||||
$this->assertFalse($route->handles('baz'));
|
|
||||||
|
|
||||||
$route = new Laravel\Routing\Route('GET /', array('handles' => array('GET /', 'GET /home')));
|
$route = new Laravel\Routing\Route('GET /', array('handles' => array('GET /', 'GET /home')));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user