public function testRouteWithOptionalTokens() { $route = new Route('/foo/{bar?}/{baz?}', 'index', 'TestController@helloAction'); list($controller, $method) = $route->getAction(); $this->assertEquals('TestController', $controller); $this->assertEquals('helloAction', $method); $this->assertNotFalse($route->matches(Request::create('/foo'))); $this->assertNotFalse($route->matches(Request::create('/foo/bar'))); $this->assertNotFalse($route->matches(Request::create('/foo/bar/baz'))); $this->assertFalse($route->matches(Request::create('/'))); $this->assertFalse($route->matches(Request::create('/foo/bar/baz/biz'))); $this->assertEquals('Hello, Matthew!', (string) call_user_func_array([new $controller(), $method], ['Matthew'])); }