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 /apps/dav/tests/unit | |
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 'apps/dav/tests/unit')
13 files changed, 202 insertions, 202 deletions
diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index 257c6665dfe..cc942b5662c 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -130,7 +130,7 @@ class CalDavBackendTest extends AbstractCalDavBackend { $l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function ($text, $parameters = array()) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php index 9a9f36c9309..42cbeb1c0b9 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php @@ -53,7 +53,7 @@ class CalendarTest extends TestCase { $this->l10n ->expects($this->any()) ->method('t') - ->willReturnCallback(function ($text, $parameters = array()) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); }); } diff --git a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php index 5cd4e69b7f5..518c0b9402a 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php @@ -97,9 +97,9 @@ class CustomPropertiesBackendTest extends \Test\TestCase { ' WHERE `userid` = ?' ); $deleteStatement->execute( - array( + [ $this->user->getUID(), - ) + ] ); $deleteStatement->closeCursor(); } @@ -121,10 +121,10 @@ class CustomPropertiesBackendTest extends \Test\TestCase { private function applyDefaultProps($path = '/dummypath') { // properties to set - $propPatch = new \Sabre\DAV\PropPatch(array( + $propPatch = new \Sabre\DAV\PropPatch([ 'customprop' => 'value1', 'customprop2' => 'value2', - )); + ]); $this->plugin->propPatch( $path, @@ -146,11 +146,11 @@ class CustomPropertiesBackendTest extends \Test\TestCase { public function testPropFindMissingFileSoftFail() { $propFind = new \Sabre\DAV\PropFind( '/dummypath', - array( + [ 'customprop', 'customprop2', 'unsetprop', - ), + ], 0 ); @@ -176,11 +176,11 @@ class CustomPropertiesBackendTest extends \Test\TestCase { $propFind = new \Sabre\DAV\PropFind( '/dummypath', - array( + [ 'customprop', 'customprop2', 'unsetprop', - ), + ], 0 ); @@ -191,7 +191,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase { $this->assertEquals('value1', $propFind->get('customprop')); $this->assertEquals('value2', $propFind->get('customprop2')); - $this->assertEquals(array('unsetprop'), $propFind->get404Properties()); + $this->assertEquals(['unsetprop'], $propFind->get404Properties()); } /** @@ -201,11 +201,11 @@ class CustomPropertiesBackendTest extends \Test\TestCase { $this->applyDefaultProps('/dummypath'); $this->applyDefaultProps('/dummypath/test.txt'); - $propNames = array( + $propNames = [ 'customprop', 'customprop2', 'unsetprop', - ); + ]; $propFindRoot = new \Sabre\DAV\PropFind( '/dummypath', @@ -234,11 +234,11 @@ class CustomPropertiesBackendTest extends \Test\TestCase { $this->assertEquals('value1', $propFindRoot->get('customprop')); $this->assertEquals('value2', $propFindRoot->get('customprop2')); - $this->assertEquals(array('unsetprop'), $propFindRoot->get404Properties()); + $this->assertEquals(['unsetprop'], $propFindRoot->get404Properties()); $this->assertEquals('value1', $propFindSub->get('customprop')); $this->assertEquals('value2', $propFindSub->get('customprop2')); - $this->assertEquals(array('unsetprop'), $propFindSub->get404Properties()); + $this->assertEquals(['unsetprop'], $propFindSub->get404Properties()); } /** @@ -247,9 +247,9 @@ class CustomPropertiesBackendTest extends \Test\TestCase { public function testDeleteProperty() { $this->applyDefaultProps(); - $propPatch = new \Sabre\DAV\PropPatch(array( + $propPatch = new \Sabre\DAV\PropPatch([ 'customprop' => null, - )); + ]); $this->plugin->propPatch( '/dummypath', diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php index 1bf0b533966..9ace061fd0e 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php @@ -201,7 +201,7 @@ class DirectoryTest extends \Test\TestCase { $this->view->expects($this->once()) ->method('getDirectoryContent') ->with('') - ->willReturn(array($info1, $info2)); + ->willReturn([$info1, $info2]); $this->view->expects($this->any()) ->method('getRelativePath') diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php index 96f5a2c385c..a898ba5dee7 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -202,9 +202,9 @@ class FileTest extends TestCase { ->method('getRelativePath') ->willReturnArgument(0); - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -631,10 +631,10 @@ class FileTest extends TestCase { } public static function cancellingHook($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_post_create, 'params' => $params - ); + ]; } /** @@ -683,9 +683,9 @@ class FileTest extends TestCase { $_SERVER['CONTENT_LENGTH'] = 123456; $_SERVER['REQUEST_METHOD'] = 'PUT'; - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -716,9 +716,9 @@ class FileTest extends TestCase { // simulate situation where the target file is locked $view->lockFile('/test.txt', ILockingProvider::LOCK_EXCLUSIVE); - $info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -790,9 +790,9 @@ class FileTest extends TestCase { ->method('getRelativePath') ->willReturnArgument(0); - $info = new \OC\Files\FileInfo('/*', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/*', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); // action @@ -829,9 +829,9 @@ class FileTest extends TestCase { ->method('getRelativePath') ->willReturnArgument(0); - $info = new \OC\Files\FileInfo('/*', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/*', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); $file->setName('/super*star.txt'); } @@ -856,9 +856,9 @@ class FileTest extends TestCase { $_SERVER['CONTENT_LENGTH'] = 12345; $_SERVER['REQUEST_METHOD'] = 'PUT'; - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -890,9 +890,9 @@ class FileTest extends TestCase { ->method('unlink') ->willReturn(true); - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -908,9 +908,9 @@ class FileTest extends TestCase { $view = $this->getMockBuilder(View::class) ->getMock(); - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => 0 - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -931,9 +931,9 @@ class FileTest extends TestCase { ->method('unlink') ->willReturn(false); - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -954,9 +954,9 @@ class FileTest extends TestCase { ->method('unlink') ->willThrowException(new ForbiddenException('', true)); - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -1122,9 +1122,9 @@ class FileTest extends TestCase { ->method('fopen') ->willReturn(false); - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); @@ -1142,9 +1142,9 @@ class FileTest extends TestCase { ->method('fopen') ->willThrowException(new ForbiddenException('', true)); - $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( + $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [ 'permissions' => \OCP\Constants::PERMISSION_ALL - ), null); + ], null); $file = new \OCA\DAV\Connector\Sabre\File($view, $info); diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php index d1e863b18ba..06495ccd5e2 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php @@ -181,7 +181,7 @@ class FilesPluginTest extends TestCase { $propFind = new PropFind( '/dummyPath', - array( + [ self::GETETAG_PROPERTYNAME, self::FILEID_PROPERTYNAME, self::INTERNAL_FILEID_PROPERTYNAME, @@ -191,7 +191,7 @@ class FilesPluginTest extends TestCase { self::OWNER_ID_PROPERTYNAME, self::OWNER_DISPLAY_NAME_PROPERTYNAME, self::DATA_FINGERPRINT_PROPERTYNAME, - ), + ], 0 ); @@ -208,7 +208,7 @@ class FilesPluginTest extends TestCase { $node->expects($this->once()) ->method('getDirectDownload') - ->willReturn(array('url' => 'http://example.com/')); + ->willReturn(['url' => 'http://example.com/']); $node->expects($this->exactly(2)) ->method('getOwner') ->willReturn($user); @@ -236,9 +236,9 @@ class FilesPluginTest extends TestCase { $propFind = new PropFind( '/dummyPath', - array( + [ self::DOWNLOADURL_PROPERTYNAME, - ), + ], 0 ); @@ -293,14 +293,14 @@ class FilesPluginTest extends TestCase { $propFind = new PropFind( '/dummyPath', - array( + [ self::GETETAG_PROPERTYNAME, self::FILEID_PROPERTYNAME, self::SIZE_PROPERTYNAME, self::PERMISSIONS_PROPERTYNAME, self::DOWNLOADURL_PROPERTYNAME, self::DATA_FINGERPRINT_PROPERTYNAME, - ), + ], 0 ); @@ -405,10 +405,10 @@ class FilesPluginTest extends TestCase { ->willReturn(true); // properties to set - $propPatch = new PropPatch(array( + $propPatch = new PropPatch([ self::GETETAG_PROPERTYNAME => 'newetag', self::LASTMODIFIED_PROPERTYNAME => $testDate - )); + ]); $this->plugin->handleUpdateProperties( '/dummypath', @@ -425,14 +425,14 @@ class FilesPluginTest extends TestCase { } public function testUpdatePropsForbidden() { - $propPatch = new PropPatch(array( + $propPatch = new PropPatch([ self::OWNER_ID_PROPERTYNAME => 'user2', self::OWNER_DISPLAY_NAME_PROPERTYNAME => 'User Two', self::FILEID_PROPERTYNAME => 12345, self::PERMISSIONS_PROPERTYNAME => 'C', self::SIZE_PROPERTYNAME => 123, self::DOWNLOADURL_PROPERTYNAME => 'http://example.com/', - )); + ]); $this->plugin->handleUpdateProperties( '/dummypath', @@ -588,9 +588,9 @@ class FilesPluginTest extends TestCase { $propFind = new PropFind( '/dummyPath', - array( + [ self::HAS_PREVIEW_PROPERTYNAME - ), + ], 0 ); diff --git a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php index 5d71a705362..93542f80368 100644 --- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php @@ -42,19 +42,19 @@ use OCP\Share\IShare; */ class NodeTest extends \Test\TestCase { public function davPermissionsProvider() { - return array( - array(\OCP\Constants::PERMISSION_ALL, 'file', false, false, 'RGDNVW'), - array(\OCP\Constants::PERMISSION_ALL, 'dir', false, false, 'RGDNVCK'), - array(\OCP\Constants::PERMISSION_ALL, 'file', true, false, 'SRGDNVW'), - array(\OCP\Constants::PERMISSION_ALL, 'file', true, true, 'SRMGDNVW'), - array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_SHARE, 'file', true, false, 'SGDNVW'), - array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_UPDATE, 'file', false, false, 'RGD'), - array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_DELETE, 'file', false, false, 'RGNVW'), - array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'file', false, false, 'RGDNVW'), - array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_READ, 'file', false, false, 'RDNVW'), - array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'dir', false, false, 'RGDNV'), - array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_READ, 'dir', false, false, 'RDNVCK'), - ); + return [ + [\OCP\Constants::PERMISSION_ALL, 'file', false, false, 'RGDNVW'], + [\OCP\Constants::PERMISSION_ALL, 'dir', false, false, 'RGDNVCK'], + [\OCP\Constants::PERMISSION_ALL, 'file', true, false, 'SRGDNVW'], + [\OCP\Constants::PERMISSION_ALL, 'file', true, true, 'SRMGDNVW'], + [\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_SHARE, 'file', true, false, 'SGDNVW'], + [\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_UPDATE, 'file', false, false, 'RGD'], + [\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_DELETE, 'file', false, false, 'RGNVW'], + [\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'file', false, false, 'RGDNVW'], + [\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_READ, 'file', false, false, 'RDNVW'], + [\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'dir', false, false, 'RGDNV'], + [\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_READ, 'dir', false, false, 'RDNVCK'], + ]; } /** @@ -63,7 +63,7 @@ class NodeTest extends \Test\TestCase { public function testDavPermissions($permissions, $type, $shared, $mounted, $expected) { $info = $this->getMockBuilder(FileInfo::class) ->disableOriginalConstructor() - ->setMethods(array('getPermissions', 'isShared', 'isMounted', 'getType')) + ->setMethods(['getPermissions', 'isShared', 'isMounted', 'getType']) ->getMock(); $info->expects($this->any()) ->method('getPermissions') diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php index 76ebbe30189..3a2c8d8c438 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php @@ -201,72 +201,72 @@ class ObjectTreeTest extends \Test\TestCase { } function nodeForPathProvider() { - return array( + return [ // regular file - array( + [ 'regularfile.txt', 'regularfile.txt', 'regularfile.txt', 'file', false - ), + ], // regular directory - array( + [ 'regulardir', 'regulardir', 'regulardir', 'dir', false - ), + ], // regular file with chunking - array( + [ 'regularfile.txt', 'regularfile.txt', 'regularfile.txt', 'file', true - ), + ], // regular directory with chunking - array( + [ 'regulardir', 'regulardir', 'regulardir', 'dir', true - ), + ], // file with chunky file name - array( + [ 'regularfile.txt-chunking-123566789-10-1', 'regularfile.txt', 'regularfile.txt', 'file', true - ), + ], // regular file in subdir - array( + [ 'subdir/regularfile.txt', 'subdir/regularfile.txt', 'regularfile.txt', 'file', false - ), + ], // regular directory in subdir - array( + [ 'subdir/regulardir', 'subdir/regulardir', 'regulardir', 'dir', false - ), + ], // file with chunky file name in subdir - array( + [ 'subdir/regularfile.txt-chunking-123566789-10-1', 'subdir/regularfile.txt', 'regularfile.txt', 'file', true - ), - ); + ], + ]; } diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php index 57613c19f64..55528a0f87f 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php @@ -410,7 +410,7 @@ class PrincipalTest extends TestCase { } public function testUpdatePrincipal() { - $this->assertSame(0, $this->connector->updatePrincipal('foo', new PropPatch(array()))); + $this->assertSame(0, $this->connector->updatePrincipal('foo', new PropPatch([]))); } public function testSearchPrincipalsWithEmptySearchProperties() { diff --git a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php index 50b3ff1c394..d7554741fc0 100644 --- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php @@ -112,30 +112,30 @@ class QuotaPluginTest extends TestCase { } public function quotaOkayProvider() { - return array( - array(1024, array()), - array(1024, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(1024, array('CONTENT-LENGTH' => '512')), - array(1024, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')), - - array(FileInfo::SPACE_UNKNOWN, array()), - array(FileInfo::SPACE_UNKNOWN, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(FileInfo::SPACE_UNKNOWN, array('CONTENT-LENGTH' => '512')), - array(FileInfo::SPACE_UNKNOWN, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')), - - array(FileInfo::SPACE_UNLIMITED, array()), - array(FileInfo::SPACE_UNLIMITED, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(FileInfo::SPACE_UNLIMITED, array('CONTENT-LENGTH' => '512')), - array(FileInfo::SPACE_UNLIMITED, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')), - ); + return [ + [1024, []], + [1024, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [1024, ['CONTENT-LENGTH' => '512']], + [1024, ['OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512']], + + [FileInfo::SPACE_UNKNOWN, []], + [FileInfo::SPACE_UNKNOWN, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [FileInfo::SPACE_UNKNOWN, ['CONTENT-LENGTH' => '512']], + [FileInfo::SPACE_UNKNOWN, ['OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512']], + + [FileInfo::SPACE_UNLIMITED, []], + [FileInfo::SPACE_UNLIMITED, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [FileInfo::SPACE_UNLIMITED, ['CONTENT-LENGTH' => '512']], + [FileInfo::SPACE_UNLIMITED, ['OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512']], + ]; } public function quotaExceededProvider() { - return array( - array(1023, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(511, array('CONTENT-LENGTH' => '512')), - array(2047, array('OC-TOTAL-LENGTH' => '2048', 'CONTENT-LENGTH' => '1024')), - ); + return [ + [1023, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [511, ['CONTENT-LENGTH' => '512']], + [2047, ['OC-TOTAL-LENGTH' => '2048', 'CONTENT-LENGTH' => '1024']], + ]; } public function lengthProvider() { @@ -155,22 +155,22 @@ class QuotaPluginTest extends TestCase { } public function quotaChunkedOkProvider() { - return array( - array(1024, 0, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(1024, 0, array('CONTENT-LENGTH' => '512')), - array(1024, 0, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')), + return [ + [1024, 0, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [1024, 0, ['CONTENT-LENGTH' => '512']], + [1024, 0, ['OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512']], // with existing chunks (allowed size = total length - chunk total size) - array(400, 128, array('X-EXPECTED-ENTITY-LENGTH' => '512')), - array(400, 128, array('CONTENT-LENGTH' => '512')), - array(400, 128, array('OC-TOTAL-LENGTH' => '512', 'CONTENT-LENGTH' => '500')), + [400, 128, ['X-EXPECTED-ENTITY-LENGTH' => '512']], + [400, 128, ['CONTENT-LENGTH' => '512']], + [400, 128, ['OC-TOTAL-LENGTH' => '512', 'CONTENT-LENGTH' => '500']], // \OCP\Files\FileInfo::SPACE-UNKNOWN = -2 - array(-2, 0, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(-2, 0, array('CONTENT-LENGTH' => '512')), - array(-2, 0, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')), - array(-2, 128, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(-2, 128, array('CONTENT-LENGTH' => '512')), - array(-2, 128, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')), - ); + [-2, 0, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [-2, 0, ['CONTENT-LENGTH' => '512']], + [-2, 0, ['OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512']], + [-2, 128, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [-2, 128, ['CONTENT-LENGTH' => '512']], + [-2, 128, ['OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512']], + ]; } /** @@ -197,15 +197,15 @@ class QuotaPluginTest extends TestCase { } public function quotaChunkedFailProvider() { - return array( - array(400, 0, array('X-EXPECTED-ENTITY-LENGTH' => '1024')), - array(400, 0, array('CONTENT-LENGTH' => '512')), - array(400, 0, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')), + return [ + [400, 0, ['X-EXPECTED-ENTITY-LENGTH' => '1024']], + [400, 0, ['CONTENT-LENGTH' => '512']], + [400, 0, ['OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512']], // with existing chunks (allowed size = total length - chunk total size) - array(380, 128, array('X-EXPECTED-ENTITY-LENGTH' => '512')), - array(380, 128, array('CONTENT-LENGTH' => '512')), - array(380, 128, array('OC-TOTAL-LENGTH' => '512', 'CONTENT-LENGTH' => '500')), - ); + [380, 128, ['X-EXPECTED-ENTITY-LENGTH' => '512']], + [380, 128, ['CONTENT-LENGTH' => '512']], + [380, 128, ['OC-TOTAL-LENGTH' => '512', 'CONTENT-LENGTH' => '500']], + ]; } /** diff --git a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php index c1eaaae42c3..c0450d3bbb6 100644 --- a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php @@ -108,8 +108,8 @@ class TagsPluginTest extends \Test\TestCase { $this->tagger->expects($this->exactly($expectedCallCount)) ->method('getTagsForObjects') - ->with($this->equalTo(array(123))) - ->willReturn(array(123 => $tags)); + ->with($this->equalTo([123])) + ->willReturn([123 => $tags]); $propFind = new \Sabre\DAV\PropFind( '/dummyPath', @@ -162,16 +162,16 @@ class TagsPluginTest extends \Test\TestCase { ->willReturn(123); $node->expects($this->exactly($expectedCallCount)) ->method('getChildren') - ->willReturn(array($node1, $node2)); + ->willReturn([$node1, $node2]); $this->tagger->expects($this->exactly($expectedCallCount)) ->method('getTagsForObjects') - ->with($this->equalTo(array(123, 111, 222))) + ->with($this->equalTo([123, 111, 222])) ->willReturn( - array( + [ 111 => $tags, 123 => $tags - ) + ] ); // simulate sabre recursive PROPFIND traversal @@ -212,58 +212,58 @@ class TagsPluginTest extends \Test\TestCase { } function tagsGetPropertiesDataProvider() { - return array( + return [ // request both, receive both - array( - array('tag1', 'tag2', self::TAG_FAVORITE), - array(self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME), - array( - 200 => array( - self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array('tag1', 'tag2')), + [ + ['tag1', 'tag2', self::TAG_FAVORITE], + [self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME], + [ + 200 => [ + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2']), self::FAVORITE_PROPERTYNAME => true, - ) - ) - ), + ] + ] + ], // request tags alone - array( - array('tag1', 'tag2', self::TAG_FAVORITE), - array(self::TAGS_PROPERTYNAME), - array( - 200 => array( - self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array('tag1', 'tag2')), - ) - ) - ), + [ + ['tag1', 'tag2', self::TAG_FAVORITE], + [self::TAGS_PROPERTYNAME], + [ + 200 => [ + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2']), + ] + ] + ], // request fav alone - array( - array('tag1', 'tag2', self::TAG_FAVORITE), - array(self::FAVORITE_PROPERTYNAME), - array( - 200 => array( + [ + ['tag1', 'tag2', self::TAG_FAVORITE], + [self::FAVORITE_PROPERTYNAME], + [ + 200 => [ self::FAVORITE_PROPERTYNAME => true, - ) - ) - ), + ] + ] + ], // request none - array( - array('tag1', 'tag2', self::TAG_FAVORITE), - array(), - array( - 200 => array() - ), - ), + [ + ['tag1', 'tag2', self::TAG_FAVORITE], + [], + [ + 200 => [] + ], + ], // request both with none set, receive both - array( - array(), - array(self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME), - array( - 200 => array( - self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array()), + [ + [], + [self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME], + [ + 200 => [ + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList([]), self::FAVORITE_PROPERTYNAME => false, - ) - ) - ), - ); + ] + ] + ], + ]; } public function testUpdateTags() { @@ -283,8 +283,8 @@ class TagsPluginTest extends \Test\TestCase { $this->tagger->expects($this->at(0)) ->method('getTagsForObjects') - ->with($this->equalTo(array(123))) - ->willReturn(array(123 => array('tagkeep', 'tagremove', self::TAG_FAVORITE))); + ->with($this->equalTo([123])) + ->willReturn([123 => ['tagkeep', 'tagremove', self::TAG_FAVORITE]]); // then tag as tag1 and tag2 $this->tagger->expects($this->at(1)) @@ -300,9 +300,9 @@ class TagsPluginTest extends \Test\TestCase { ->with(123, 'tagremove'); // properties to set - $propPatch = new \Sabre\DAV\PropPatch(array( - self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array('tag1', 'tag2', 'tagkeep')) - )); + $propPatch = new \Sabre\DAV\PropPatch([ + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2', 'tagkeep']) + ]); $this->plugin->handleUpdateProperties( '/dummypath', @@ -334,8 +334,8 @@ class TagsPluginTest extends \Test\TestCase { $this->tagger->expects($this->at(0)) ->method('getTagsForObjects') - ->with($this->equalTo(array(123))) - ->willReturn(array()); + ->with($this->equalTo([123])) + ->willReturn([]); // then tag as tag1 and tag2 $this->tagger->expects($this->at(1)) @@ -346,9 +346,9 @@ class TagsPluginTest extends \Test\TestCase { ->with(123, 'tag2'); // properties to set - $propPatch = new \Sabre\DAV\PropPatch(array( - self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(array('tag1', 'tag2', 'tagkeep')) - )); + $propPatch = new \Sabre\DAV\PropPatch([ + self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2', 'tagkeep']) + ]); $this->plugin->handleUpdateProperties( '/dummypath', @@ -386,9 +386,9 @@ class TagsPluginTest extends \Test\TestCase { ->with(123, self::TAG_FAVORITE); // properties to set - $propPatch = new \Sabre\DAV\PropPatch(array( + $propPatch = new \Sabre\DAV\PropPatch([ self::FAVORITE_PROPERTYNAME => true - )); + ]); $this->plugin->handleUpdateProperties( '/dummypath', @@ -411,9 +411,9 @@ class TagsPluginTest extends \Test\TestCase { ->with(123, self::TAG_FAVORITE); // properties to set - $propPatch = new \Sabre\DAV\PropPatch(array( + $propPatch = new \Sabre\DAV\PropPatch([ self::FAVORITE_PROPERTYNAME => false - )); + ]); $this->plugin->handleUpdateProperties( '/dummypath', diff --git a/apps/dav/tests/unit/DAV/GroupPrincipalTest.php b/apps/dav/tests/unit/DAV/GroupPrincipalTest.php index 08239dfd46a..6a78c2a0862 100644 --- a/apps/dav/tests/unit/DAV/GroupPrincipalTest.php +++ b/apps/dav/tests/unit/DAV/GroupPrincipalTest.php @@ -184,7 +184,7 @@ class GroupPrincipalTest extends \Test\TestCase { } public function testUpdatePrincipal() { - $this->assertSame(0, $this->connector->updatePrincipal('foo', new PropPatch(array()))); + $this->assertSame(0, $this->connector->updatePrincipal('foo', new PropPatch([]))); } public function testSearchPrincipalsWithEmptySearchProperties() { diff --git a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php index f634c717093..ecd65e7587c 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php @@ -308,12 +308,12 @@ class SystemTagPluginTest extends \Test\TestCase { ->with($systemTag, ['group1', 'group2']); // properties to set - $propPatch = new \Sabre\DAV\PropPatch(array( + $propPatch = new \Sabre\DAV\PropPatch([ self::DISPLAYNAME_PROPERTYNAME => 'Test changed', self::USERVISIBLE_PROPERTYNAME => 'false', self::USERASSIGNABLE_PROPERTYNAME => 'true', self::GROUPS_PROPERTYNAME => 'group1|group2', - )); + ]); $this->plugin->handleUpdateProperties( '/systemtag/1', @@ -364,9 +364,9 @@ class SystemTagPluginTest extends \Test\TestCase { ->method('setTagGroups'); // properties to set - $propPatch = new \Sabre\DAV\PropPatch(array( + $propPatch = new \Sabre\DAV\PropPatch([ self::GROUPS_PROPERTYNAME => 'group1|group2', - )); + ]); $this->plugin->handleUpdateProperties( '/systemtag/1', |