fixed bug in router.

This commit is contained in:
Taylor Otwell
2012-01-18 11:41:13 -06:00
parent 6865db3f21
commit 73c09f2f29
4 changed files with 8 additions and 4 deletions

View File

@@ -62,7 +62,7 @@ class Auth {
{
if ( ! is_null(static::$user)) return static::$user;
$id = Session::get(Auth::user_key);
$id = IoC::core('session')->get(Auth::user_key);
// To retrieve the user, we'll first attempt to use the "user" Closure
// defined in the auth configuration file, passing in the ID. The user

View File

@@ -79,7 +79,7 @@ class Route {
*/
protected static function extract($segment)
{
$uri = substr($segment, strpos($segment, ' '));
$uri = substr($segment, strpos($segment, ' ') + 1);
return ($uri !== '/') ? trim($uri, '/') : $uri;
}

View File

@@ -200,6 +200,8 @@ class Router {
$action = array('uses' => Bundle::prefix($bundle).'home@index');
$action['handles'] = array($destination);
return new Route($method.' '.$uri, $action);
}
@@ -243,6 +245,8 @@ class Router {
$action = array('uses' => $prefix.$controller.'@'.$method);
$action['handles'] = array($destination);
return new Route($destination, $action, $segments);
}
}

View File

@@ -17,13 +17,13 @@ class RouteTest extends PHPUnit_Framework_TestCase {
*/
public function testHandlesIndicatesIfTheRouteHandlesAGivenURI()
{
$route = new Laravel\Routing\Route('GET /', array('handles' => array('foo/bar')));
$route = new Laravel\Routing\Route('GET /', array('handles' => array('GET /foo/bar')));
$this->assertTrue($route->handles('foo/*'));
$this->assertTrue($route->handles('foo/bar'));
$this->assertFalse($route->handles('baz'));
$route = new Laravel\Routing\Route('GET /', array('handles' => array('/', 'home')));
$route = new Laravel\Routing\Route('GET /', array('handles' => array('GET /', 'GET /home')));
$this->assertTrue($route->handles('/'));
$this->assertTrue($route->handles('home'));