diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-26 09:30:18 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-26 16:34:56 +0100 |
commit | b80ebc96748b45fd2e0ba9323308657c4b00b7ec (patch) | |
tree | ec20e0ffa2f86b9b54939a83a785407319f94559 /tests/lib/AppTest.php | |
parent | 62403d0932be7d620c7bdadc6b4e13eb496fcd6f (diff) | |
download | nextcloud-server-b80ebc96748b45fd2e0ba9323308657c4b00b7ec.tar.gz nextcloud-server-b80ebc96748b45fd2e0ba9323308657c4b00b7ec.zip |
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/AppTest.php')
-rw-r--r-- | tests/lib/AppTest.php | 304 |
1 files changed, 152 insertions, 152 deletions
diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php index 3ec70d7142a..75084e7f0f3 100644 --- a/tests/lib/AppTest.php +++ b/tests/lib/AppTest.php @@ -28,245 +28,245 @@ class AppTest extends \Test\TestCase { const TEST_GROUP2 = 'group2'; public function appVersionsProvider() { - return array( + return [ // exact match - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '6.0', 'requiremax' => '6.0', - ), + ], true - ), + ], // in-between match - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '7.0', - ), + ], true - ), + ], // app too old - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '5.0', - ), + ], false - ), + ], // app too new - array( + [ '5.0.0.0', - array( + [ 'requiremin' => '6.0', 'requiremax' => '6.0', - ), + ], false - ), + ], // only min specified - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '6.0', - ), + ], true - ), + ], // only min specified fail - array( + [ '5.0.0.0', - array( + [ 'requiremin' => '6.0', - ), + ], false - ), + ], // only min specified legacy - array( + [ '6.0.0.0', - array( + [ 'require' => '6.0', - ), + ], true - ), + ], // only min specified legacy fail - array( + [ '4.0.0.0', - array( + [ 'require' => '6.0', - ), + ], false - ), + ], // only max specified - array( + [ '5.0.0.0', - array( + [ 'requiremax' => '6.0', - ), + ], true - ), + ], // only max specified fail - array( + [ '7.0.0.0', - array( + [ 'requiremax' => '6.0', - ), + ], false - ), + ], // variations of versions // single OC number - array( + [ '4', - array( + [ 'require' => '4.0', - ), + ], true - ), + ], // multiple OC number - array( + [ '4.3.1', - array( + [ 'require' => '4.3', - ), + ], true - ), + ], // single app number - array( + [ '4', - array( + [ 'require' => '4', - ), + ], true - ), + ], // single app number fail - array( + [ '4.3', - array( + [ 'require' => '5', - ), + ], false - ), + ], // complex - array( + [ '5.0.0', - array( + [ 'require' => '4.5.1', - ), + ], true - ), + ], // complex fail - array( + [ '4.3.1', - array( + [ 'require' => '4.3.2', - ), + ], false - ), + ], // two numbers - array( + [ '4.3.1', - array( + [ 'require' => '4.4', - ), + ], false - ), + ], // one number fail - array( + [ '4.3.1', - array( + [ 'require' => '5', - ), + ], false - ), + ], // pre-alpha app - array( + [ '5.0.3', - array( + [ 'require' => '4.93', - ), + ], true - ), + ], // pre-alpha OC - array( + [ '6.90.0.2', - array( + [ 'require' => '6.90', - ), + ], true - ), + ], // pre-alpha OC max - array( + [ '6.90.0.2', - array( + [ 'requiremax' => '7', - ), + ], true - ), + ], // expect same major number match - array( + [ '5.0.3', - array( + [ 'require' => '5', - ), + ], true - ), + ], // expect same major number match - array( + [ '5.0.3', - array( + [ 'requiremax' => '5', - ), + ], true - ), + ], // dependencies versions before require* - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '7.0', - 'dependencies' => array( - 'owncloud' => array( - '@attributes' => array( + 'dependencies' => [ + 'owncloud' => [ + '@attributes' => [ 'min-version' => '7.0', 'max-version' => '7.0', - ), - ), - ), - ), + ], + ], + ], + ], false - ), - array( + ], + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '7.0', - 'dependencies' => array( - 'owncloud' => array( - '@attributes' => array( + 'dependencies' => [ + 'owncloud' => [ + '@attributes' => [ 'min-version' => '5.0', 'max-version' => '5.0', - ), - ), - ), - ), + ], + ], + ], + ], false - ), - array( + ], + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '5.0', - 'dependencies' => array( - 'owncloud' => array( - '@attributes' => array( + 'dependencies' => [ + 'owncloud' => [ + '@attributes' => [ 'min-version' => '5.0', 'max-version' => '7.0', - ), - ), - ), - ), + ], + ], + ], + ], true - ), + ], [ '9.2.0.0', [ @@ -301,7 +301,7 @@ class AppTest extends \Test\TestCase { ], true ], - ); + ]; } /** @@ -329,11 +329,11 @@ class AppTest extends \Test\TestCase { * Providers for the app config values */ public function appConfigValuesProvider() { - return array( + return [ // logged in user1 - array( + [ self::TEST_USER1, - array( + [ 'files', 'app1', 'app3', @@ -349,13 +349,13 @@ class AppTest extends \Test\TestCase { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], false - ), + ], // logged in user2 - array( + [ self::TEST_USER2, - array( + [ 'files', 'app1', 'app3', @@ -371,13 +371,13 @@ class AppTest extends \Test\TestCase { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], false - ), + ], // logged in user3 - array( + [ self::TEST_USER3, - array( + [ 'files', 'app1', 'app3', @@ -394,13 +394,13 @@ class AppTest extends \Test\TestCase { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], false - ), + ], // no user, returns all apps - array( + [ null, - array( + [ 'files', 'app1', 'app3', @@ -417,13 +417,13 @@ class AppTest extends \Test\TestCase { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], false, - ), + ], // user given, but ask for all - array( + [ self::TEST_USER1, - array( + [ 'files', 'app1', 'app3', @@ -440,10 +440,10 @@ class AppTest extends \Test\TestCase { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], true, - ), - ); + ], + ]; } /** @@ -470,14 +470,14 @@ class AppTest extends \Test\TestCase { $this->setupAppConfigMock()->expects($this->once()) ->method('getValues') ->willReturn( - array( + [ 'app3' => 'yes', 'app2' => 'no', 'app1' => 'yes', 'appforgroup1' => '["group1"]', 'appforgroup2' => '["group2"]', 'appforgroup12' => '["group2","group1"]', - ) + ] ); @@ -509,19 +509,19 @@ class AppTest extends \Test\TestCase { $this->setupAppConfigMock()->expects($this->once()) ->method('getValues') ->willReturn( - array( + [ 'app3' => 'yes', 'app2' => 'no', - ) + ] ); $apps = \OC_App::getEnabledApps(); - $this->assertEquals(array('files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'settings', 'twofactor_backupcodes', 'viewer', 'workflowengine'), $apps); + $this->assertEquals(['files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'settings', 'twofactor_backupcodes', 'viewer', 'workflowengine'], $apps); // mock should not be called again here $apps = \OC_App::getEnabledApps(); - $this->assertEquals(array('files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'settings', 'twofactor_backupcodes', 'viewer', 'workflowengine'), $apps); + $this->assertEquals(['files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'settings', 'twofactor_backupcodes', 'viewer', 'workflowengine'], $apps); $this->restoreAppConfig(); \OC_User::setUserId(null); |