added route test for handles method. fixed bug in route class.

This commit is contained in:
Taylor Otwell 2012-01-18 11:25:11 -06:00
parent f4e1eaf29e
commit aa427bbd39
2 changed files with 26 additions and 1 deletions

View File

@ -79,7 +79,7 @@ public function __construct($key, $action, $parameters = array())
*/
protected static function extract($segment)
{
$uri = substr($segment, strpos($segment, ' ') + 1);
$uri = substr($segment, strpos($segment, ' '));
return ($uri !== '/') ? trim($uri, '/') : $uri;
}

View File

@ -0,0 +1,25 @@
<?php
class RouteTest extends PHPUnit_Framework_TestCase {
/**
* Destroy the testing environment.
*/
public function tearDown()
{
Request::$route = null;
}
/**
* Tests the Route::handles method.
*
* @group laravel
*/
public function testHandlesReturnsTrueWhenRouteHandlesTheGivenURI()
{
$route = new Laravel\Routing\Route('GET /', array('handles' => array('foo/bar')));
$this->assertTrue($route->handles('foo/bar'));
}
}