From 09ee297356d80c4c20897860b2ef05b81bd2ad44 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 26 Feb 2015 08:39:55 +0100 Subject: [PATCH] New array syntax --- apps/files_sharing/lib/capabilities.php | 14 ++-- apps/files_sharing/tests/capabilities.php | 98 +++++++++++------------ 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/apps/files_sharing/lib/capabilities.php b/apps/files_sharing/lib/capabilities.php index 37ce9084137..896378eacae 100644 --- a/apps/files_sharing/lib/capabilities.php +++ b/apps/files_sharing/lib/capabilities.php @@ -53,14 +53,14 @@ class Capabilities { * @return \OC_OCS_Result */ public function getCaps() { - $res = array(); + $res = []; - $public = array(); + $public = []; $public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes'; if ($public['enabled']) { $public['password_enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'yes') === 'yes'); - $public['expire_date'] = array(); + $public['expire_date'] = []; $public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'yes') === 'yes'; if ($public['expire_date']['enabled']) { $public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); @@ -76,11 +76,11 @@ class Capabilities { $res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes'; - return new \OC_OCS_Result(array( - 'capabilities' => array( + return new \OC_OCS_Result([ + 'capabilities' => [ 'files_sharing' => $res - ), - )); + ], + ]); } } diff --git a/apps/files_sharing/tests/capabilities.php b/apps/files_sharing/tests/capabilities.php index 64d198e070b..2d7a0fe0222 100644 --- a/apps/files_sharing/tests/capabilities.php +++ b/apps/files_sharing/tests/capabilities.php @@ -61,9 +61,9 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { * @covers OCA\Files_Sharing\Capabilities::getCaps */ public function testNoLinkSharing() { - $map = array( - array('core', 'shareapi_allow_links', 'yes', 'no'), - ); + $map = [ + ['core', 'shareapi_allow_links', 'yes', 'no'], + ]; $result = $this->getResults($map); $this->assertInternalType('array', $result['public']); $this->assertFalse($result['public']['enabled']); @@ -73,9 +73,9 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { * @covers OCA\Files_Sharing\Capabilities::getCaps */ public function testOnlyLinkSharing() { - $map = array( - array('core', 'shareapi_allow_links', 'yes', 'yes'), - ); + $map = [ + ['core', 'shareapi_allow_links', 'yes', 'yes'], + ]; $result = $this->getResults($map); $this->assertInternalType('array', $result['public']); $this->assertTrue($result['public']['enabled']); @@ -85,10 +85,10 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { * @covers OCA\Files_Sharing\Capabilities::getCaps */ public function testLinkPassword() { - $map = array( - array('core', 'shareapi_allow_links', 'yes', 'yes'), - array('core', 'shareapi_enforce_links_password', 'yes', 'yes'), - ); + $map = [ + ['core', 'shareapi_allow_links', 'yes', 'yes'], + ['core', 'shareapi_enforce_links_password', 'yes', 'yes'], + ]; $result = $this->getResults($map); $this->assertArrayHasKey('password_enforced', $result['public']); $this->assertTrue($result['public']['password_enforced']); @@ -98,10 +98,10 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { * @covers OCA\Files_Sharing\Capabilities::getCaps */ public function testLinkNoPassword() { - $map = array( - array('core', 'shareapi_allow_links', 'yes', 'yes'), - array('core', 'shareapi_enforce_links_password', 'yes', 'no'), - ); + $map = [ + ['core', 'shareapi_allow_links', 'yes', 'yes'], + ['core', 'shareapi_enforce_links_password', 'yes', 'no'], + ]; $result = $this->getResults($map); $this->assertArrayHasKey('password_enforced', $result['public']); $this->assertFalse($result['public']['password_enforced']); @@ -111,10 +111,10 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { * @covers OCA\Files_Sharing\Capabilities::getCaps */ public function testLinkNoExpireDate() { - $map = array( - array('core', 'shareapi_allow_links', 'yes', 'yes'), - array('core', 'shareapi_default_expire_date', 'yes', 'no'), - ); + $map = [ + ['core', 'shareapi_allow_links', 'yes', 'yes'], + ['core', 'shareapi_default_expire_date', 'yes', 'no'], + ]; $result = $this->getResults($map); $this->assertArrayHasKey('expire_date', $result['public']); $this->assertInternalType('array', $result['public']['expire_date']); @@ -125,12 +125,12 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { * @covers OCA\Files_Sharing\Capabilities::getCaps */ public function testLinkExpireDate() { - $map = array( - array('core', 'shareapi_allow_links', 'yes', 'yes'), - array('core', 'shareapi_default_expire_date', 'yes', 'yes'), - array('core', 'shareapi_expire_after_n_days', '7', '7'), - array('core', 'shareapi_enforce_expire_date', 'yes', 'no'), - ); + $map = [ + ['core', 'shareapi_allow_links', 'yes', 'yes'], + ['core', 'shareapi_default_expire_date', 'yes', 'yes'], + ['core', 'shareapi_expire_after_n_days', '7', '7'], + ['core', 'shareapi_enforce_expire_date', 'yes', 'no'], + ]; $result = $this->getResults($map); $this->assertArrayHasKey('expire_date', $result['public']); $this->assertInternalType('array', $result['public']['expire_date']); @@ -143,11 +143,11 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { * @covers OCA\Files_Sharing\Capabilities::getCaps */ public function testLinkExpireDateEnforced() { - $map = array( - array('core', 'shareapi_allow_links', 'yes', 'yes'), - array('core', 'shareapi_default_expire_date', 'yes', 'yes'), - array('core', 'shareapi_enforce_expire_date', 'yes', 'yes'), - ); + $map = [ + ['core', 'shareapi_allow_links', 'yes', 'yes'], + ['core', 'shareapi_default_expire_date', 'yes', 'yes'], + ['core', 'shareapi_enforce_expire_date', 'yes', 'yes'], + ]; $result = $this->getResults($map); $this->assertArrayHasKey('expire_date', $result['public']); $this->assertInternalType('array', $result['public']['expire_date']); @@ -158,10 +158,10 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { * @covers OCA\Files_Sharing\Capabilities::getCaps */ public function testLinkSendMail() { - $map = array( - array('core', 'shareapi_allow_links', 'yes', 'yes'), - array('core', 'shareapi_allow_public_notification', 'yes', 'yes'), - ); + $map = [ + ['core', 'shareapi_allow_links', 'yes', 'yes'], + ['core', 'shareapi_allow_public_notification', 'yes', 'yes'], + ]; $result = $this->getResults($map); $this->assertTrue($result['public']['send_mail']); } @@ -170,10 +170,10 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { * @covers OCA\Files_Sharing\Capabilities::getCaps */ public function testLinkNoSendMail() { - $map = array( - array('core', 'shareapi_allow_links', 'yes', 'yes'), - array('core', 'shareapi_allow_public_notification', 'yes', 'no'), - ); + $map = [ + ['core', 'shareapi_allow_links', 'yes', 'yes'], + ['core', 'shareapi_allow_public_notification', 'yes', 'no'], + ]; $result = $this->getResults($map); $this->assertFalse($result['public']['send_mail']); } @@ -182,9 +182,9 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { * @covers OCA\Files_Sharing\Capabilities::getCaps */ public function testUserSendMail() { - $map = array( - array('core', 'shareapi_allow_mail_notification', 'yes', 'yes'), - ); + $map = [ + ['core', 'shareapi_allow_mail_notification', 'yes', 'yes'], + ]; $result = $this->getResults($map); $this->assertTrue($result['user']['send_mail']); } @@ -193,9 +193,9 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { * @covers OCA\Files_Sharing\Capabilities::getCaps */ public function testUserNoSendMail() { - $map = array( - array('core', 'shareapi_allow_mail_notification', 'yes', 'no'), - ); + $map = [ + ['core', 'shareapi_allow_mail_notification', 'yes', 'no'], + ]; $result = $this->getResults($map); $this->assertFalse($result['user']['send_mail']); } @@ -204,9 +204,9 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { * @covers OCA\Files_Sharing\Capabilities::getCaps */ public function testResharing() { - $map = array( - array('core', 'shareapi_allow_resharing', 'yes', 'yes'), - ); + $map = [ + ['core', 'shareapi_allow_resharing', 'yes', 'yes'], + ]; $result = $this->getResults($map); $this->assertTrue($result['resharing']); } @@ -215,9 +215,9 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { * @covers OCA\Files_Sharing\Capabilities::getCaps */ public function testNoResharing() { - $map = array( - array('core', 'shareapi_allow_resharing', 'yes', 'no'), - ); + $map = [ + ['core', 'shareapi_allow_resharing', 'yes', 'no'], + ]; $result = $this->getResults($map); $this->assertFalse($result['resharing']); } -- 2.39.5