diff options
Diffstat (limited to 'tests/lib/AppFramework/Routing/RoutingTest.php')
-rw-r--r-- | tests/lib/AppFramework/Routing/RoutingTest.php | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php index 4d184adcdb1..95f8996dbdb 100644 --- a/tests/lib/AppFramework/Routing/RoutingTest.php +++ b/tests/lib/AppFramework/Routing/RoutingTest.php @@ -15,9 +15,9 @@ class RoutingTest extends \Test\TestCase public function testSimpleRoute() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'GET') - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'GET'] + ]]; $this->assertSimpleRoute($routes, 'folders.open', 'GET', '/folders/{folderId}/open', 'FoldersController', 'open'); } @@ -33,9 +33,9 @@ class RoutingTest extends \Test\TestCase public function testSimpleRouteWithMissingVerb() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open') - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open'] + ]]; $this->assertSimpleRoute($routes, 'folders.open', 'GET', '/folders/{folderId}/open', 'FoldersController', 'open'); } @@ -51,9 +51,9 @@ class RoutingTest extends \Test\TestCase public function testSimpleRouteWithLowercaseVerb() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete') - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete'] + ]]; $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open'); } @@ -69,11 +69,11 @@ class RoutingTest extends \Test\TestCase public function testSimpleRouteWithRequirements() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'requirements' => array('something')) - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'requirements' => ['something']] + ]]; - $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', array('something')); + $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', ['something']); } public function testSimpleOCSRouteWithRequirements() { @@ -87,11 +87,11 @@ class RoutingTest extends \Test\TestCase public function testSimpleRouteWithDefaults() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', array(), 'defaults' => array('param' => 'foobar')) - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', [], 'defaults' => ['param' => 'foobar']] + ]]; - $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', array(), array('param' => 'foobar')); + $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', [], ['param' => 'foobar']); } @@ -106,11 +106,11 @@ class RoutingTest extends \Test\TestCase public function testSimpleRouteWithPostfix() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'postfix' => '_something') - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'postfix' => '_something'] + ]]; - $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', array(), array(), '_something'); + $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', [], [], '_something'); } public function testSimpleOCSRouteWithPostfix() { @@ -127,9 +127,9 @@ class RoutingTest extends \Test\TestCase { $this->expectException(\UnexpectedValueException::class); - $routes = array('routes' => array( - array('name' => 'folders_open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete') - )); + $routes = ['routes' => [ + ['name' => 'folders_open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete'] + ]]; // router mock $router = $this->getMockBuilder('\OC\Route\Router') @@ -167,9 +167,9 @@ class RoutingTest extends \Test\TestCase public function testSimpleRouteWithUnderScoreNames() { - $routes = array('routes' => array( - array('name' => 'admin_folders#open_current', 'url' => '/folders/{folderId}/open', 'verb' => 'delete') - )); + $routes = ['routes' => [ + ['name' => 'admin_folders#open_current', 'url' => '/folders/{folderId}/open', 'verb' => 'delete'] + ]]; $this->assertSimpleRoute($routes, 'admin_folders.open_current', 'DELETE', '/folders/{folderId}/open', 'AdminFoldersController', 'openCurrent'); } @@ -205,14 +205,14 @@ class RoutingTest extends \Test\TestCase public function testResource() { - $routes = array('resources' => array('account' => array('url' => '/accounts'))); + $routes = ['resources' => ['account' => ['url' => '/accounts']]]; $this->assertResource($routes, 'account', '/accounts', 'AccountController', 'id'); } public function testResourceWithUnderScoreName() { - $routes = array('resources' => array('admin_accounts' => array('url' => '/admin/accounts'))); + $routes = ['resources' => ['admin_accounts' => ['url' => '/admin/accounts']]]; $this->assertResource($routes, 'admin_accounts', '/admin/accounts', 'AdminAccountsController', 'id'); } @@ -224,7 +224,7 @@ class RoutingTest extends \Test\TestCase * @param string $controllerName * @param string $actionName */ - private function assertSimpleRoute($routes, $name, $verb, $url, $controllerName, $actionName, array $requirements=array(), array $defaults=array(), $postfix='') + private function assertSimpleRoute($routes, $name, $verb, $url, $controllerName, $actionName, array $requirements=[], array $defaults=[], $postfix='') { if ($postfix) { $name .= $postfix; @@ -270,8 +270,8 @@ class RoutingTest extends \Test\TestCase $url, $controllerName, $actionName, - array $requirements=array(), - array $defaults=array(), + array $requirements=[], + array $defaults=[], $postfix='') { if ($postfix) { @@ -437,8 +437,8 @@ class RoutingTest extends \Test\TestCase $verb, $controllerName, $actionName, - array $requirements=array(), - array $defaults=array() + array $requirements=[], + array $defaults=[] ) { $route = $this->getMockBuilder('\OC\Route\Route') ->setMethods(['method', 'action', 'requirements', 'defaults']) |