Skip to content

Commit

Permalink
update docblock + tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Joris Vaesen committed Jan 16, 2017
1 parent 34a3c69 commit 74fed15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Routing/Router.php
Expand Up @@ -971,6 +971,9 @@ public static function scope($path, $params = [], $callback = null)
* For example a path of `admin` would result in `'prefix' => 'admin'` being
* applied to all connected routes.
*
* The prefix name will be inflected to the underscore version to create
* the routing path. If you want a custom path name, use the `path` option.
*
* You can re-open a prefix as many times as necessary, as well as nest prefixes.
* Nested prefixes will result in prefix values like `admin/api` which translates
* to the `Controller\Admin\Api\` namespace.
Expand Down
6 changes: 6 additions & 0 deletions tests/TestCase/Routing/RouterTest.php
Expand Up @@ -3104,6 +3104,12 @@ public function testPrefixOptions()
$this->assertEquals('/admin', $routes->path());
$this->assertEquals(['prefix' => 'admin', 'param' => 'value'], $routes->params());
});

Router::prefix('CustomPath', ['path' => '/custom-path'], function ($routes) {
$this->assertInstanceOf('Cake\Routing\RouteBuilder', $routes);
$this->assertEquals('/custom-path', $routes->path());
$this->assertEquals(['prefix' => 'CustomPath'], $routes->params());
});
}

/**
Expand Down

0 comments on commit 74fed15

Please sign in to comment.