diff options
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r-- | apps/files_sharing/tests/ApiTest.php | 16 | ||||
-rw-r--r-- | apps/files_sharing/tests/CacheTest.php | 180 | ||||
-rw-r--r-- | apps/files_sharing/tests/Controller/ShareAPIControllerTest.php | 8 | ||||
-rw-r--r-- | apps/files_sharing/tests/Controller/ShareControllerTest.php | 12 | ||||
-rw-r--r-- | apps/files_sharing/tests/External/CacheTest.php | 12 | ||||
-rw-r--r-- | apps/files_sharing/tests/ExternalStorageTest.php | 32 | ||||
-rw-r--r-- | apps/files_sharing/tests/ShareTest.php | 14 | ||||
-rw-r--r-- | apps/files_sharing/tests/SharedMountTest.php | 16 | ||||
-rw-r--r-- | apps/files_sharing/tests/SharedStorageTest.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/tests/WatcherTest.php | 10 |
10 files changed, 153 insertions, 153 deletions
diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index c510c4dad98..a356525260f 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -648,12 +648,12 @@ class ApiTest extends TestCase { $share3->setStatus(IShare::STATUS_ACCEPTED); $this->shareManager->updateShare($share3); - $testValues=array( - array('query' => $this->folder, - 'expectedResult' => $this->folder . $this->filename), - array('query' => $this->folder . $this->subfolder, - 'expectedResult' => $this->folder . $this->subfolder . $this->filename), - ); + $testValues=[ + ['query' => $this->folder, + 'expectedResult' => $this->folder . $this->filename], + ['query' => $this->folder . $this->subfolder, + 'expectedResult' => $this->folder . $this->subfolder . $this->filename], + ]; foreach ($testValues as $value) { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER2); @@ -1214,7 +1214,7 @@ class ApiTest extends TestCase { */ public static function initTestMountPointsHook($data) { if ($data['user'] === self::TEST_FILES_SHARING_API_USER1) { - \OC\Files\Filesystem::mount(self::$tempStorage, array(), '/' . self::TEST_FILES_SHARING_API_USER1 . '/files' . self::TEST_FOLDER_NAME); + \OC\Files\Filesystem::mount(self::$tempStorage, [], '/' . self::TEST_FILES_SHARING_API_USER1 . '/files' . self::TEST_FOLDER_NAME); } } @@ -1222,7 +1222,7 @@ class ApiTest extends TestCase { * Tests mounting a folder that is an external storage mount point. */ public function testShareStorageMountPoint() { - $tempStorage = new \OC\Files\Storage\Temporary(array()); + $tempStorage = new \OC\Files\Storage\Temporary([]); $tempStorage->file_put_contents('test.txt', 'abcdef'); $tempStorage->getScanner()->scan(''); diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php index 1c05e70f080..cba90e8f9e6 100644 --- a/apps/files_sharing/tests/CacheTest.php +++ b/apps/files_sharing/tests/CacheTest.php @@ -148,63 +148,63 @@ class CacheTest extends TestCase { } function searchDataProvider() { - return array( - array('%another%', - array( - array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'), - array('name' => 'another.txt', 'path' => 'subdir/another.txt'), - ) - ), - array('%Another%', - array( - array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'), - array('name' => 'another.txt', 'path' => 'subdir/another.txt'), - ) - ), - array('%dir%', - array( - array('name' => 'emptydir', 'path' => 'emptydir'), - array('name' => 'subdir', 'path' => 'subdir'), - array('name' => 'shareddir', 'path' => ''), - ) - ), - array('%Dir%', - array( - array('name' => 'emptydir', 'path' => 'emptydir'), - array('name' => 'subdir', 'path' => 'subdir'), - array('name' => 'shareddir', 'path' => ''), - ) - ), - array('%txt%', - array( - array('name' => 'bar.txt', 'path' => 'bar.txt'), - array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'), - array('name' => 'another.txt', 'path' => 'subdir/another.txt'), - ) - ), - array('%Txt%', - array( - array('name' => 'bar.txt', 'path' => 'bar.txt'), - array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'), - array('name' => 'another.txt', 'path' => 'subdir/another.txt'), - ) - ), - array('%', - array( - array('name' => 'bar.txt', 'path' => 'bar.txt'), - array('name' => 'emptydir', 'path' => 'emptydir'), - array('name' => 'subdir', 'path' => 'subdir'), - array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'), - array('name' => 'another.txt', 'path' => 'subdir/another.txt'), - array('name' => 'not a text file.xml', 'path' => 'subdir/not a text file.xml'), - array('name' => 'shareddir', 'path' => ''), - ) - ), - array('%nonexistent%', - array( - ) - ), - ); + return [ + ['%another%', + [ + ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'], + ['name' => 'another.txt', 'path' => 'subdir/another.txt'], + ] + ], + ['%Another%', + [ + ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'], + ['name' => 'another.txt', 'path' => 'subdir/another.txt'], + ] + ], + ['%dir%', + [ + ['name' => 'emptydir', 'path' => 'emptydir'], + ['name' => 'subdir', 'path' => 'subdir'], + ['name' => 'shareddir', 'path' => ''], + ] + ], + ['%Dir%', + [ + ['name' => 'emptydir', 'path' => 'emptydir'], + ['name' => 'subdir', 'path' => 'subdir'], + ['name' => 'shareddir', 'path' => ''], + ] + ], + ['%txt%', + [ + ['name' => 'bar.txt', 'path' => 'bar.txt'], + ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'], + ['name' => 'another.txt', 'path' => 'subdir/another.txt'], + ] + ], + ['%Txt%', + [ + ['name' => 'bar.txt', 'path' => 'bar.txt'], + ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'], + ['name' => 'another.txt', 'path' => 'subdir/another.txt'], + ] + ], + ['%', + [ + ['name' => 'bar.txt', 'path' => 'bar.txt'], + ['name' => 'emptydir', 'path' => 'emptydir'], + ['name' => 'subdir', 'path' => 'subdir'], + ['name' => 'another too.txt', 'path' => 'subdir/another too.txt'], + ['name' => 'another.txt', 'path' => 'subdir/another.txt'], + ['name' => 'not a text file.xml', 'path' => 'subdir/not a text file.xml'], + ['name' => 'shareddir', 'path' => ''], + ] + ], + ['%nonexistent%', + [ + ] + ], + ]; } /** @@ -226,20 +226,20 @@ class CacheTest extends TestCase { */ function testSearchByMime() { $results = $this->sharedStorage->getCache()->searchByMime('text'); - $check = array( - array( + $check = [ + [ 'name' => 'bar.txt', 'path' => 'bar.txt' - ), - array( + ], + [ 'name' => 'another too.txt', 'path' => 'subdir/another too.txt' - ), - array( + ], + [ 'name' => 'another.txt', 'path' => 'subdir/another.txt' - ), - ); + ], + ]; $this->verifyFiles($check, $results); } @@ -250,27 +250,27 @@ class CacheTest extends TestCase { // additional root will always contain the example file "welcome.txt", // so this will be part of the result $this->verifyFiles( - array( - array( + [ + [ 'name' => 'welcome.txt', 'path' => 'files/welcome.txt', 'mimetype' => 'text/plain', - ), - array( + ], + [ 'name' => 'shareddir', 'path' => 'files/shareddir', 'mimetype' => 'httpd/unix-directory', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - array( + ], + [ 'name' => 'shared single file.txt', 'path' => 'files/shared single file.txt', 'mimetype' => 'text/plain', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - ), + ], + ], $results ); } @@ -279,29 +279,29 @@ class CacheTest extends TestCase { $results = $this->user2View->getDirectoryContent('/shareddir'); $this->verifyFiles( - array( - array( + [ + [ 'name' => 'bar.txt', 'path' => 'bar.txt', 'mimetype' => 'text/plain', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - array( + ], + [ 'name' => 'emptydir', 'path' => 'emptydir', 'mimetype' => 'httpd/unix-directory', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - array( + ], + [ 'name' => 'subdir', 'path' => 'subdir', 'mimetype' => 'httpd/unix-directory', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - ), + ], + ], $results ); } @@ -327,29 +327,29 @@ class CacheTest extends TestCase { $results = $thirdView->getDirectoryContent('/subdir'); $this->verifyFiles( - array( - array( + [ + [ 'name' => 'another too.txt', 'path' => 'another too.txt', 'mimetype' => 'text/plain', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - array( + ], + [ 'name' => 'another.txt', 'path' => 'another.txt', 'mimetype' => 'text/plain', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - array( + ], + [ 'name' => 'not a text file.xml', 'path' => 'not a text file.xml', 'mimetype' => 'application/xml', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', - ), - ), + ], + ], $results ); @@ -376,7 +376,7 @@ class CacheTest extends TestCase { } } } - $this->assertEquals(array(), $results); + $this->assertEquals([], $results); } /** diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index 69b00ff9424..e8fb3454e1e 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -1525,7 +1525,7 @@ class ShareAPIControllerTest extends TestCase { ->willReturn(true); $helper = $this->getMockBuilder('\OCA\Talk\Share\Helper\ShareAPIController') - ->setMethods(array('canAccessShare')) + ->setMethods(['canAccessShare']) ->getMock(); $helper->method('canAccessShare') ->with($share, $this->currentUser) @@ -2170,7 +2170,7 @@ class ShareAPIControllerTest extends TestCase { ->willReturn(true); $helper = $this->getMockBuilder('\OCA\Talk\Share\Helper\ShareAPIController') - ->setMethods(array('createShare')) + ->setMethods(['createShare']) ->getMock(); $helper->method('createShare') ->with( @@ -2293,7 +2293,7 @@ class ShareAPIControllerTest extends TestCase { ->willReturn(true); $helper = $this->getMockBuilder('\OCA\Talk\Share\Helper\ShareAPIController') - ->setMethods(array('createShare')) + ->setMethods(['createShare']) ->getMock(); $helper->method('createShare') ->with( @@ -4291,7 +4291,7 @@ class ShareAPIControllerTest extends TestCase { ->willReturn(true); $helper = $this->getMockBuilder('\OCA\Talk\Share\Helper\ShareAPIController') - ->setMethods(array('formatShare')) + ->setMethods(['formatShare']) ->getMock(); $helper->method('formatShare') ->with($share) diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php index 35807dffe82..c560595a7b4 100644 --- a/apps/files_sharing/tests/Controller/ShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php @@ -287,7 +287,7 @@ class ShareControllerTest extends \Test\TestCase { }); $response = $this->shareController->showShare(); - $sharedTmplParams = array( + $sharedTmplParams = [ 'displayName' => 'ownerDisplay', 'owner' => 'ownerUID', 'filename' => 'file1.txt', @@ -315,7 +315,7 @@ class ShareControllerTest extends \Test\TestCase { 'note' => $note, 'hideDownload' => false, 'showgridview' => false - ); + ]; $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy(); $csp->addAllowedFrameDomain('\'self\''); @@ -427,7 +427,7 @@ class ShareControllerTest extends \Test\TestCase { }); $response = $this->shareController->showShare(); - $sharedTmplParams = array( + $sharedTmplParams = [ 'displayName' => 'ownerDisplay', 'owner' => 'ownerUID', 'filename' => 'file1.txt', @@ -455,7 +455,7 @@ class ShareControllerTest extends \Test\TestCase { 'note' => $note, 'hideDownload' => true, 'showgridview' => false - ); + ]; $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy(); $csp->addAllowedFrameDomain('\'self\''); @@ -541,7 +541,7 @@ class ShareControllerTest extends \Test\TestCase { unset($responseParams['folder']); $response->setParams($responseParams); - $sharedTmplParams = array( + $sharedTmplParams = [ 'displayName' => 'ownerDisplay', 'owner' => 'ownerUID', 'filename' => '/fileDrop', @@ -569,7 +569,7 @@ class ShareControllerTest extends \Test\TestCase { 'note' => '', 'hideDownload' => false, 'showgridview' => false - ); + ]; $csp = new \OCP\AppFramework\Http\ContentSecurityPolicy(); $csp->addAllowedFrameDomain('\'self\''); diff --git a/apps/files_sharing/tests/External/CacheTest.php b/apps/files_sharing/tests/External/CacheTest.php index 766f0232b87..42cd05ebdf4 100644 --- a/apps/files_sharing/tests/External/CacheTest.php +++ b/apps/files_sharing/tests/External/CacheTest.php @@ -76,11 +76,11 @@ class CacheTest extends TestCase { ); $this->cache->put( 'test.txt', - array( + [ 'mimetype' => 'text/plain', 'size' => 5, 'mtime' => 123, - ) + ] ); } @@ -107,19 +107,19 @@ class CacheTest extends TestCase { public function testGetFolderPopulatesOwner() { $dirId = $this->cache->put( 'subdir', - array( + [ 'mimetype' => 'httpd/unix-directory', 'size' => 5, 'mtime' => 123, - ) + ] ); $this->cache->put( 'subdir/contents.txt', - array( + [ 'mimetype' => 'text/plain', 'size' => 5, 'mtime' => 123, - ) + ] ); $results = $this->cache->getFolderContentsById($dirId); diff --git a/apps/files_sharing/tests/ExternalStorageTest.php b/apps/files_sharing/tests/ExternalStorageTest.php index b4e84846ed4..2a9577bccb9 100644 --- a/apps/files_sharing/tests/ExternalStorageTest.php +++ b/apps/files_sharing/tests/ExternalStorageTest.php @@ -39,37 +39,37 @@ use OCP\Http\Client\IResponse; class ExternalStorageTest extends \Test\TestCase { function optionsProvider() { - return array( - array( + return [ + [ 'http://remoteserver:8080/owncloud', 'http://remoteserver:8080/owncloud/public.php/webdav/', - ), + ], // extra slash - array( + [ 'http://remoteserver:8080/owncloud/', 'http://remoteserver:8080/owncloud/public.php/webdav/', - ), + ], // extra path - array( + [ 'http://remoteserver:8080/myservices/owncloud/', 'http://remoteserver:8080/myservices/owncloud/public.php/webdav/', - ), + ], // root path - array( + [ 'http://remoteserver:8080/', 'http://remoteserver:8080/public.php/webdav/', - ), + ], // without port - array( + [ 'http://remoteserver/oc.test', 'http://remoteserver/oc.test/public.php/webdav/', - ), + ], // https - array( + [ 'https://remoteserver/', 'https://remoteserver/public.php/webdav/', - ), - ); + ], + ]; } private function getTestStorage($uri) { @@ -91,7 +91,7 @@ class ExternalStorageTest extends \Test\TestCase { ->willReturn($client); return new TestSharingExternalStorage( - array( + [ 'cloudId' => new CloudId('testOwner@' . $uri, 'testOwner', $uri), 'remote' => $uri, 'owner' => 'testOwner', @@ -101,7 +101,7 @@ class ExternalStorageTest extends \Test\TestCase { 'manager' => null, 'certificateManager' => $certificateManager, 'HttpClientService' => $httpClientService, - ) + ] ); } diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php index 50859984133..dddeb5cf551 100644 --- a/apps/files_sharing/tests/ShareTest.php +++ b/apps/files_sharing/tests/ShareTest.php @@ -226,13 +226,13 @@ class ShareTest extends TestCase { $permission5 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE; $permission6 = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE; - return array( - array($permission1, false), - array($permission3, true), - array($permission4, true), - array($permission5, false), - array($permission6, false), - ); + return [ + [$permission1, false], + [$permission3, true], + [$permission4, true], + [$permission5, false], + [$permission6, false], + ]; } public function testFileOwner() { diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index 55abbd20cba..e63cb597950 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -251,14 +251,14 @@ class SharedMountTest extends TestCase { } public function dataProviderTestStripUserFilesPath() { - return array( - array('/user/files/foo.txt', '/foo.txt', false), - array('/user/files/folder/foo.txt', '/folder/foo.txt', false), - array('/data/user/files/foo.txt', null, true), - array('/data/user/files/', null, true), - array('/files/foo.txt', null, true), - array('/foo.txt', null, true), - ); + return [ + ['/user/files/foo.txt', '/foo.txt', false], + ['/user/files/folder/foo.txt', '/folder/foo.txt', false], + ['/data/user/files/foo.txt', null, true], + ['/data/user/files/', null, true], + ['/files/foo.txt', null, true], + ['/foo.txt', null, true], + ]; } public function dataPermissionMovedGroupShare() { diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index 59e411e47f7..1c222055d4e 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -406,7 +406,7 @@ class SharedStorageTest extends TestCase { $mountConfigManager = \OC::$server->getMountProviderCollection(); $mounts = $mountConfigManager->getMountsForUser(\OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER3)); - array_walk($mounts, array(\OC\Files\Filesystem::getMountManager(), 'addMount')); + array_walk($mounts, [\OC\Files\Filesystem::getMountManager(), 'addMount']); $this->assertTrue($rootView->file_exists('/' . self::TEST_FILES_SHARING_API_USER3 . '/files/' . $this->filename)); @@ -443,7 +443,7 @@ class SharedStorageTest extends TestCase { list($sharedStorage,) = $view->resolvePath($this->folder); $this->assertTrue($sharedStorage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')); - $sourceStorage = new \OC\Files\Storage\Temporary(array()); + $sourceStorage = new \OC\Files\Storage\Temporary([]); $sourceStorage->file_put_contents('foo.txt', 'asd'); $sharedStorage->copyFromStorage($sourceStorage, 'foo.txt', 'bar.txt'); @@ -476,7 +476,7 @@ class SharedStorageTest extends TestCase { list($sharedStorage,) = $view->resolvePath($this->folder); $this->assertTrue($sharedStorage->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')); - $sourceStorage = new \OC\Files\Storage\Temporary(array()); + $sourceStorage = new \OC\Files\Storage\Temporary([]); $sourceStorage->file_put_contents('foo.txt', 'asd'); $sharedStorage->moveFromStorage($sourceStorage, 'foo.txt', 'bar.txt'); diff --git a/apps/files_sharing/tests/WatcherTest.php b/apps/files_sharing/tests/WatcherTest.php index 093f6139dd3..0386828c4ca 100644 --- a/apps/files_sharing/tests/WatcherTest.php +++ b/apps/files_sharing/tests/WatcherTest.php @@ -115,9 +115,9 @@ class WatcherTest extends TestCase { $textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $dataLen = strlen($textData); - $this->sharedCache->put('bar.txt', array('mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain')); + $this->sharedCache->put('bar.txt', ['mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain']); $this->sharedStorage->file_put_contents('bar.txt', $textData); - $this->sharedCache->put('', array('mtime' => 10, 'storage_mtime' => 10, 'size' => '-1', 'mimetype' => 'httpd/unix-directory')); + $this->sharedCache->put('', ['mtime' => 10, 'storage_mtime' => 10, 'size' => '-1', 'mimetype' => 'httpd/unix-directory']); // run the propagation code $this->sharedStorage->getWatcher()->checkUpdate(''); @@ -145,9 +145,9 @@ class WatcherTest extends TestCase { $textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $dataLen = strlen($textData); - $this->sharedCache->put('subdir/bar.txt', array('mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain')); + $this->sharedCache->put('subdir/bar.txt', ['mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain']); $this->sharedStorage->file_put_contents('subdir/bar.txt', $textData); - $this->sharedCache->put('subdir', array('mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain')); + $this->sharedCache->put('subdir', ['mtime' => 10, 'storage_mtime' => 10, 'size' => $dataLen, 'mimetype' => 'text/plain']); // run the propagation code $this->sharedStorage->getWatcher()->checkUpdate('subdir'); @@ -173,7 +173,7 @@ class WatcherTest extends TestCase { * @param string $path */ function getOwnerDirSizes($path) { - $result = array(); + $result = []; while ($path != '' && $path != '' && $path != '.') { $cachedData = $this->ownerCache->get($path); |