added route test for handles method. fixed bug in route class.
This commit is contained in:
parent
f4e1eaf29e
commit
aa427bbd39
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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'));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue