Skip to content

Commit

Permalink
Fix issue where RouterBuilder::scope() would not allow 2 arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Aug 22, 2014
1 parent a106f21 commit 817cc77
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Routing/RouteBuilder.php
Expand Up @@ -484,7 +484,7 @@ public function plugin($name, $options = [], $callback = null) {
* @return void
* @throws \InvalidArgumentException when there is no callable parameter.
*/
public function scope($path, $params, $callback) {
public function scope($path, $params, $callback = null) {
if ($callback === null) {
$callback = $params;
$params = [];
Expand Down
6 changes: 6 additions & 0 deletions tests/TestCase/Routing/RouteBuilderTest.php
Expand Up @@ -419,6 +419,12 @@ public function testScope() {
$this->assertEquals('/api/v1', $routes->path());
$this->assertEquals(['prefix' => 'api', 'version' => 1], $routes->params());
});

$routes = new RouteBuilder($this->collection, '/api', ['prefix' => 'api']);
$routes->scope('/v1', function($routes) {
$this->assertEquals('/api/v1', $routes->path());
$this->assertEquals(['prefix' => 'api'], $routes->params());
});
}

}

0 comments on commit 817cc77

Please sign in to comment.