]> source.dussan.org Git - nextcloud-server.git/commitdiff
dont strip the s from the resource
authorBernhard Posselt <dev@bernhard-posselt.com>
Thu, 26 Jun 2014 12:02:20 +0000 (14:02 +0200)
committerBernhard Posselt <dev@bernhard-posselt.com>
Thu, 26 Jun 2014 12:02:20 +0000 (14:02 +0200)
lib/private/appframework/routing/routeconfig.php
tests/lib/appframework/routing/RoutingTest.php

index 91ea7778d0868d5c1a5b4a31d9f1c23f1eeb481c..634bc888bdb8e1751d894a908fe26be559b663fd 100644 (file)
@@ -88,7 +88,7 @@ class RouteConfig {
                                                        ->method($verb)
                                                        ->action($handler);
 
-                       // optionally register requirements for route. This is used to 
+                       // optionally register requirements for route. This is used to
                        // tell the route parser how url parameters should be matched
                        if(array_key_exists('requirements', $simpleRoute)) {
                                $router->requirements($simpleRoute['requirements']);
@@ -174,7 +174,7 @@ class RouteConfig {
         * @return string
         */
        private function buildResourceId($resource) {
-               return '{'.$this->underScoreToCamelCase(rtrim($resource, 's')).'Id}';
+               return '{' . $this->underScoreToCamelCase($resource) . 'Id}';
        }
 
        /**
index 261ab0b26af759d3c7f521b26fe13bbc34c03b4a..89cc77d684a572da2802c93da8852f1f33eb7ed7 100644 (file)
@@ -6,7 +6,7 @@ use OC\AppFramework\DependencyInjection\DIContainer;
 use OC\AppFramework\routing\RouteConfig;
 
 
-class RouteConfigTest extends \PHPUnit_Framework_TestCase
+class RoutingTest extends \PHPUnit_Framework_TestCase
 {
 
        public function testSimpleRoute()
@@ -76,16 +76,16 @@ class RouteConfigTest extends \PHPUnit_Framework_TestCase
 
        public function testResource()
        {
-               $routes = array('resources' => array('accounts' => array('url' => '/accounts')));
+               $routes = array('resources' => array('account' => array('url' => '/accounts')));
 
-               $this->assertResource($routes, 'accounts', '/accounts', 'AccountsController', 'accountId');
+               $this->assertResource($routes, 'account', '/accounts', 'AccountController', 'accountId');
        }
 
        public function testResourceWithUnderScoreName()
        {
                $routes = array('resources' => array('admin_accounts' => array('url' => '/admin/accounts')));
 
-               $this->assertResource($routes, 'admin_accounts', '/admin/accounts', 'AdminAccountsController', 'adminAccountId');
+               $this->assertResource($routes, 'admin_accounts', '/admin/accounts', 'AdminAccountsController', 'adminAccountsId');
        }
 
        /**