Skip to content
Permalink
Browse files

Rename resource() to resources().

Using the plural form makes more sense as the table names are plural and
controllers are plural too.
  • Loading branch information...
markstory committed Jun 26, 2014
1 parent 4d9e65e commit 1b2fc5868434770239288eed1f4e2bc44f6c59bb
Showing with 10 additions and 10 deletions.
  1. +5 −5 src/Routing/ScopedRouteCollection.php
  2. +5 −5 tests/TestCase/Routing/ScopedRouteCollectionTest.php
@@ -189,7 +189,7 @@ public function get($name) {
*
* {{{
* Router::plugin('Comments', function ($routes) {
* $routes->resource('Comments');
* $routes->resources('Comments');
* });
* }}}
*
@@ -201,7 +201,7 @@ public function get($name) {
*
* {{{
* Router::prefix('admin', function ($routes) {
* $routes->resource('Articles');
* $routes->resources('Articles');
* });
* }}}
*
@@ -211,8 +211,8 @@ public function get($name) {
* You can create nested resources by passing a callback in:
*
* {{{
* $routes->resource('Articles', function($routes) {
* $routes->resource('Comments');
* $routes->resources('Articles', function($routes) {
* $routes->resources('Comments');
* });
* }}}
*
@@ -229,7 +229,7 @@ public function get($name) {
* scopes inherit the existing path and 'id' parameter.
* @return array Array of mapped resources
*/
public function resource($name, $options = [], $callback = null) {
public function resources($name, $options = [], $callback = null) {
if (is_callable($options) && $callback === null) {
$callback = $options;
$options = [];
@@ -319,9 +319,9 @@ public function testMatchPlugin() {
*
* @return void
*/
public function testResource() {
public function testResources() {
$routes = new ScopedRouteCollection('/api', ['prefix' => 'api']);
$routes->resource('Articles', ['_ext' => 'json']);
$routes->resources('Articles', ['_ext' => 'json']);
$all = $routes->routes();
$this->assertCount(6, $all);
@@ -336,13 +336,13 @@ public function testResource() {
*
* @return void
*/
public function testResourceNested() {
public function testResourcesNested() {
$routes = new ScopedRouteCollection('/api', ['prefix' => 'api']);
$routes->resource('Articles', function($routes) {
$routes->resources('Articles', function($routes) {
$this->assertEquals('/api/articles/', $routes->path());
$this->assertEquals(['prefix' => 'api'], $routes->params());
$routes->resource('Comments');
$routes->resources('Comments');
$route = $routes->routes()[0];
$this->assertEquals('/api/articles/:article_id/comments', $route->template);
});

0 comments on commit 1b2fc58

Please sign in to comment.
You can’t perform that action at this time.