diff options
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/ajax/download.php | 4 | ||||
-rw-r--r-- | apps/files/ajax/list.php | 20 | ||||
-rw-r--r-- | apps/files/appinfo/app.php | 2 | ||||
-rw-r--r-- | apps/files/lib/AppInfo/Application.php | 2 | ||||
-rw-r--r-- | apps/files/lib/Command/Scan.php | 2 | ||||
-rw-r--r-- | apps/files/lib/Controller/ViewController.php | 2 | ||||
-rw-r--r-- | apps/files/lib/Helper.php | 8 | ||||
-rw-r--r-- | apps/files/lib/Service/TagService.php | 2 | ||||
-rw-r--r-- | apps/files/templates/appnavigation.php | 2 | ||||
-rw-r--r-- | apps/files/tests/BackgroundJob/ScanFilesTest.php | 24 | ||||
-rw-r--r-- | apps/files/tests/Controller/ApiControllerTest.php | 4 | ||||
-rw-r--r-- | apps/files/tests/Controller/ViewControllerTest.php | 62 | ||||
-rw-r--r-- | apps/files/tests/HelperTest.php | 50 | ||||
-rw-r--r-- | apps/files/tests/Service/TagServiceTest.php | 22 |
14 files changed, 103 insertions, 103 deletions
diff --git a/apps/files/ajax/download.php b/apps/files/ajax/download.php index 5b29175a83c..d5ea0f634f2 100644 --- a/apps/files/ajax/download.php +++ b/apps/files/ajax/download.php @@ -38,7 +38,7 @@ $dir = isset($_GET['dir']) ? (string)$_GET['dir'] : ''; $files_list = json_decode($files); // in case we get only a single file if (!is_array($files_list)) { - $files_list = array($files); + $files_list = [$files]; } /** @@ -52,7 +52,7 @@ if(isset($_GET['downloadStartSecret']) setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/'); } -$server_params = array( 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' ); +$server_params = [ 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' ]; /** * Http range requests support diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php index 0b66ed10897..8cbe5841aaf 100644 --- a/apps/files/ajax/list.php +++ b/apps/files/ajax/list.php @@ -43,7 +43,7 @@ try { exit(); } - $data = array(); + $data = []; $baseUrl = \OC::$server->getURLGenerator()->linkTo('files', 'index.php') . '?dir='; $permissions = $dirInfo->getPermissions(); @@ -80,7 +80,7 @@ try { $data['files'] = \OCA\Files\Helper::formatFileInfos($files); $data['permissions'] = $permissions; - \OC_JSON::success(array('data' => $data)); + \OC_JSON::success(['data' => $data]); } catch (\OCP\Files\StorageNotAvailableException $e) { \OC::$server->getLogger()->logException($e, ['app' => 'files']); \OC_JSON::error([ @@ -91,18 +91,18 @@ try { ]); } catch (\OCP\Files\StorageInvalidException $e) { \OC::$server->getLogger()->logException($e, ['app' => 'files']); - \OC_JSON::error(array( - 'data' => array( + \OC_JSON::error([ + 'data' => [ 'exception' => StorageInvalidException::class, 'message' => $l->t('Storage invalid') - ) - )); + ] + ]); } catch (\Exception $e) { \OC::$server->getLogger()->logException($e, ['app' => 'files']); - \OC_JSON::error(array( - 'data' => array( + \OC_JSON::error([ + 'data' => [ 'exception' => \Exception::class, 'message' => $l->t('Unknown error') - ) - )); + ] + ]); } diff --git a/apps/files/appinfo/app.php b/apps/files/appinfo/app.php index 35e46c0c151..bb98613377c 100644 --- a/apps/files/appinfo/app.php +++ b/apps/files/appinfo/app.php @@ -36,7 +36,7 @@ $app = \OC::$server->query(Application::class); // t('Files') $l = \OC::$server->getL10N('files'); -\OC::$server->getSearch()->registerProvider(File::class, array('apps' => array('files'))); +\OC::$server->getSearch()->registerProvider(File::class, ['apps' => ['files']]); $templateManager = \OC_Helper::getFileTemplateManager(); $templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp'); diff --git a/apps/files/lib/AppInfo/Application.php b/apps/files/lib/AppInfo/Application.php index 8bda6329d29..b043cfeb6ac 100644 --- a/apps/files/lib/AppInfo/Application.php +++ b/apps/files/lib/AppInfo/Application.php @@ -50,7 +50,7 @@ class Application extends App { public const APP_ID = 'files'; - public function __construct(array $urlParams=array()) { + public function __construct(array $urlParams=[]) { parent::__construct(self::APP_ID, $urlParams); $container = $this->getContainer(); $server = $container->getServer(); diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php index 39eebbb2c43..38d4b1cc979 100644 --- a/apps/files/lib/Command/Scan.php +++ b/apps/files/lib/Command/Scan.php @@ -174,7 +174,7 @@ class Scan extends Base { if ($inputPath) { $inputPath = '/' . trim($inputPath, '/'); list (, $user,) = explode('/', $inputPath, 3); - $users = array($user); + $users = [$user]; } else if ($input->getOption('all')) { $users = $this->userManager->search(''); } else { diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 70b878f43ad..7c5d2a08b88 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -200,7 +200,7 @@ class ViewController extends Controller { $collapseClasses = 'collapsible'; } - $favoritesSublistArray = Array(); + $favoritesSublistArray = []; $navBarPositionPosition = 6; $currentCount = 0; diff --git a/apps/files/lib/Helper.php b/apps/files/lib/Helper.php index f88689af266..c46d3028553 100644 --- a/apps/files/lib/Helper.php +++ b/apps/files/lib/Helper.php @@ -51,7 +51,7 @@ class Helper { $l = \OC::$server->getL10N('files'); $maxUploadFileSize = \OCP\Util::maxUploadFilesize($dir, $storageInfo['free']); $maxHumanFileSize = \OCP\Util::humanFileSize($maxUploadFileSize); - $maxHumanFileSize = $l->t('Upload (max. %s)', array($maxHumanFileSize)); + $maxHumanFileSize = $l->t('Upload (max. %s)', [$maxHumanFileSize]); return [ 'uploadMaxFilesize' => $maxUploadFileSize, @@ -140,7 +140,7 @@ class Helper { * @return array formatted file info */ public static function formatFileInfo(FileInfo $i) { - $entry = array(); + $entry = []; $entry['id'] = $i['fileid']; $entry['parentId'] = $i['parent']; @@ -182,7 +182,7 @@ class Helper { * @return array */ public static function formatFileInfos($fileInfos) { - $files = array(); + $files = []; foreach ($fileInfos as $i) { $files[] = self::formatFileInfo($i); } @@ -262,7 +262,7 @@ class Helper { } else if ($sortAttribute === 'size') { $sortFunc = 'compareSize'; } - usort($files, array(Helper::class, $sortFunc)); + usort($files, [Helper::class, $sortFunc]); if ($sortDescending) { $files = array_reverse($files); } diff --git a/apps/files/lib/Service/TagService.php b/apps/files/lib/Service/TagService.php index a477db324ac..5df00ae5c5f 100644 --- a/apps/files/lib/Service/TagService.php +++ b/apps/files/lib/Service/TagService.php @@ -83,7 +83,7 @@ class TagService { public function updateFileTags($path, $tags) { $fileId = $this->homeFolder->get($path)->getId(); - $currentTags = $this->tagger->getTagsForObjects(array($fileId)); + $currentTags = $this->tagger->getTagsForObjects([$fileId]); if (!empty($currentTags)) { $currentTags = current($currentTags); diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php index b14617f0ca3..8992d266e49 100644 --- a/apps/files/templates/appnavigation.php +++ b/apps/files/templates/appnavigation.php @@ -47,7 +47,7 @@ script(\OCA\Files\AppInfo\Application::APP_ID, 'dist/files-app-settings'); <label for="webdavurl"><?php p($l->t('WebDAV')); ?></label> <input id="webdavurl" type="text" readonly="readonly" value="<?php p($_['webdav_url']); ?>"/> - <em><?php print_unescaped($l->t('Use this address to <a href="%s" target="_blank" rel="noreferrer noopener">access your Files via WebDAV</a>', array(link_to_docs('user-webdav')))); ?></em> + <em><a href="<?php echo link_to_docs('user-webdav') ?>" target="_blank" rel="noreferrer noopener"><?php p($l->t('Use this address to access your Files via WebDAV')) ?> ↗</a></em> </div> </div> diff --git a/apps/files/tests/BackgroundJob/ScanFilesTest.php b/apps/files/tests/BackgroundJob/ScanFilesTest.php index 82f69df3ddc..5686fbc749c 100644 --- a/apps/files/tests/BackgroundJob/ScanFilesTest.php +++ b/apps/files/tests/BackgroundJob/ScanFilesTest.php @@ -63,22 +63,22 @@ class ScanFilesTest extends TestCase { ->expects($this->at(0)) ->method('getSystemValueBool') ->with('files_no_background_scan', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->config ->expects($this->at(1)) ->method('getAppValue') ->with('files', 'cronjob_scan_files', 0) - ->will($this->returnValue(50)); + ->willReturn(50); $this->userManager ->expects($this->at(0)) ->method('search') ->with('', 500, 50) - ->will($this->returnValue([])); + ->willReturn([]); $this->userManager ->expects($this->at(1)) ->method('search') ->with('', 500) - ->will($this->returnValue([])); + ->willReturn([]); $this->config ->expects($this->at(2)) ->method('setAppValue') @@ -93,19 +93,19 @@ class ScanFilesTest extends TestCase { ->expects($this->at(0)) ->method('getSystemValueBool') ->with('files_no_background_scan', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->config ->expects($this->at(1)) ->method('getAppValue') ->with('files', 'cronjob_scan_files', 0) - ->will($this->returnValue(50)); + ->willReturn(50); $this->userManager ->expects($this->at(0)) ->method('search') ->with('', 500, 50) - ->will($this->returnValue([ + ->willReturn([ $fakeUser - ])); + ]); $this->config ->expects($this->at(2)) ->method('setAppValue') @@ -123,22 +123,22 @@ class ScanFilesTest extends TestCase { ->expects($this->at(0)) ->method('getSystemValueBool') ->with('files_no_background_scan', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->config ->expects($this->at(1)) ->method('getAppValue') ->with('files', 'cronjob_scan_files', 0) - ->will($this->returnValue(50)); + ->willReturn(50); $this->userManager ->expects($this->at(0)) ->method('search') ->with('', 500, 50) - ->will($this->returnValue([])); + ->willReturn([]); $this->userManager ->expects($this->at(1)) ->method('search') ->with('', 500) - ->will($this->returnValue([])); + ->willReturn([]); $this->config ->expects($this->at(2)) ->method('setAppValue') diff --git a/apps/files/tests/Controller/ApiControllerTest.php b/apps/files/tests/Controller/ApiControllerTest.php index 8b2a763ec52..b35d9d7b95d 100644 --- a/apps/files/tests/Controller/ApiControllerTest.php +++ b/apps/files/tests/Controller/ApiControllerTest.php @@ -77,11 +77,11 @@ class ApiControllerTest extends TestCase { $this->user = $this->createMock(IUser::class); $this->user->expects($this->any()) ->method('getUID') - ->will($this->returnValue('user1')); + ->willReturn('user1'); $userSession = $this->createMock(IUserSession::class); $userSession->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $this->tagService = $this->getMockBuilder(TagService::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php index 3182172acfa..8f2f8fe9ec1 100644 --- a/apps/files/tests/Controller/ViewControllerTest.php +++ b/apps/files/tests/Controller/ViewControllerTest.php @@ -91,10 +91,10 @@ class ViewControllerTest extends TestCase { $this->user = $this->getMockBuilder(IUser::class)->getMock(); $this->user->expects($this->any()) ->method('getUID') - ->will($this->returnValue('testuser1')); + ->willReturn('testuser1'); $this->userSession->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $this->rootFolder = $this->getMockBuilder('\OCP\Files\IRootFolder')->getMock(); $this->activityHelper = $this->createMock(Helper::class); $this->viewController = $this->getMockBuilder('\OCA\Files\Controller\ViewController') @@ -121,27 +121,27 @@ class ViewControllerTest extends TestCase { $this->viewController ->expects($this->once()) ->method('getStorageInfo') - ->will($this->returnValue([ + ->willReturn([ 'used' => 123, 'quota' => 100, 'total' => 100, 'relative' => 123, 'owner' => 'MyName', 'ownerDisplayName' => 'MyDisplayName', - ])); + ]); $this->config ->method('getUserValue') - ->will($this->returnValueMap([ + ->willReturnMap([ [$this->user->getUID(), 'files', 'file_sorting', 'name', 'name'], [$this->user->getUID(), 'files', 'file_sorting_direction', 'asc', 'asc'], [$this->user->getUID(), 'files', 'show_hidden', false, false], [$this->user->getUID(), 'files', 'show_grid', true], - ])); + ]); $this->config ->expects($this->any()) ->method('getAppValue') - ->will($this->returnArgument(2)); + ->willReturnArgument(2); $nav = new Template('files', 'appnavigation'); $nav->assign('usage_relative', 123); @@ -409,29 +409,29 @@ class ViewControllerTest extends TestCase { $node = $this->getMockBuilder(Folder::class)->getMock(); $node->expects($this->once()) ->method('getPath') - ->will($this->returnValue('/testuser1/files/test/sub')); + ->willReturn('/testuser1/files/test/sub'); $baseFolder = $this->getMockBuilder(Folder::class)->getMock(); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('testuser1') - ->will($this->returnValue($baseFolder)); + ->willReturn($baseFolder); $baseFolder->expects($this->at(0)) ->method('getById') ->with(123) - ->will($this->returnValue([$node])); + ->willReturn([$node]); $baseFolder->expects($this->at(1)) ->method('getRelativePath') ->with('/testuser1/files/test/sub') - ->will($this->returnValue('/test/sub')); + ->willReturn('/test/sub'); $this->urlGenerator ->expects($this->once()) ->method('linkToRoute') ->with('files.view.index', ['dir' => '/test/sub']) - ->will($this->returnValue('/apps/files/?dir=/test/sub')); + ->willReturn('/apps/files/?dir=/test/sub'); $expected = new Http\RedirectResponse('/apps/files/?dir=/test/sub'); $this->assertEquals($expected, $this->viewController->index('/whatever', '', '123')); @@ -441,37 +441,37 @@ class ViewControllerTest extends TestCase { $parentNode = $this->getMockBuilder(Folder::class)->getMock(); $parentNode->expects($this->once()) ->method('getPath') - ->will($this->returnValue('testuser1/files/test')); + ->willReturn('testuser1/files/test'); $baseFolder = $this->getMockBuilder(Folder::class)->getMock(); $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('testuser1') - ->will($this->returnValue($baseFolder)); + ->willReturn($baseFolder); $node = $this->getMockBuilder(File::class)->getMock(); $node->expects($this->once()) ->method('getParent') - ->will($this->returnValue($parentNode)); + ->willReturn($parentNode); $node->expects($this->once()) ->method('getName') - ->will($this->returnValue('somefile.txt')); + ->willReturn('somefile.txt'); $baseFolder->expects($this->at(0)) ->method('getById') ->with(123) - ->will($this->returnValue([$node])); + ->willReturn([$node]); $baseFolder->expects($this->at(1)) ->method('getRelativePath') ->with('testuser1/files/test') - ->will($this->returnValue('/test')); + ->willReturn('/test'); $this->urlGenerator ->expects($this->once()) ->method('linkToRoute') ->with('files.view.index', ['dir' => '/test', 'scrollto' => 'somefile.txt']) - ->will($this->returnValue('/apps/files/?dir=/test/sub&scrollto=somefile.txt')); + ->willReturn('/apps/files/?dir=/test/sub&scrollto=somefile.txt'); $expected = new Http\RedirectResponse('/apps/files/?dir=/test/sub&scrollto=somefile.txt'); $this->assertEquals($expected, $this->viewController->index('/whatever', '', '123')); @@ -482,12 +482,12 @@ class ViewControllerTest extends TestCase { $this->rootFolder->expects($this->once()) ->method('getUserFolder') ->with('testuser1') - ->will($this->returnValue($baseFolder)); + ->willReturn($baseFolder); $baseFolder->expects($this->at(0)) ->method('getById') ->with(123) - ->will($this->returnValue([])); + ->willReturn([]); $this->urlGenerator->expects($this->once()) ->method('linkToRoute') @@ -503,12 +503,12 @@ class ViewControllerTest extends TestCase { $this->appManager->expects($this->once()) ->method('isEnabledForUser') ->with('files_trashbin') - ->will($this->returnValue(true)); + ->willReturn(true); $parentNode = $this->getMockBuilder(Folder::class)->getMock(); $parentNode->expects($this->once()) ->method('getPath') - ->will($this->returnValue('testuser1/files_trashbin/files/test.d1462861890/sub')); + ->willReturn('testuser1/files_trashbin/files/test.d1462861890/sub'); $baseFolderFiles = $this->getMockBuilder(Folder::class)->getMock(); $baseFolderTrash = $this->getMockBuilder(Folder::class)->getMock(); @@ -516,39 +516,39 @@ class ViewControllerTest extends TestCase { $this->rootFolder->expects($this->at(0)) ->method('getUserFolder') ->with('testuser1') - ->will($this->returnValue($baseFolderFiles)); + ->willReturn($baseFolderFiles); $this->rootFolder->expects($this->at(1)) ->method('get') ->with('testuser1/files_trashbin/files/') - ->will($this->returnValue($baseFolderTrash)); + ->willReturn($baseFolderTrash); $baseFolderFiles->expects($this->once()) ->method('getById') ->with(123) - ->will($this->returnValue([])); + ->willReturn([]); $node = $this->getMockBuilder(File::class)->getMock(); $node->expects($this->once()) ->method('getParent') - ->will($this->returnValue($parentNode)); + ->willReturn($parentNode); $node->expects($this->once()) ->method('getName') - ->will($this->returnValue('somefile.txt')); + ->willReturn('somefile.txt'); $baseFolderTrash->expects($this->at(0)) ->method('getById') ->with(123) - ->will($this->returnValue([$node])); + ->willReturn([$node]); $baseFolderTrash->expects($this->at(1)) ->method('getRelativePath') ->with('testuser1/files_trashbin/files/test.d1462861890/sub') - ->will($this->returnValue('/test.d1462861890/sub')); + ->willReturn('/test.d1462861890/sub'); $this->urlGenerator ->expects($this->once()) ->method('linkToRoute') ->with('files.view.index', ['view' => 'trashbin', 'dir' => '/test.d1462861890/sub', 'scrollto' => 'somefile.txt']) - ->will($this->returnValue('/apps/files/?view=trashbin&dir=/test.d1462861890/sub&scrollto=somefile.txt')); + ->willReturn('/apps/files/?view=trashbin&dir=/test.d1462861890/sub&scrollto=somefile.txt'); $expected = new Http\RedirectResponse('/apps/files/?view=trashbin&dir=/test.d1462861890/sub&scrollto=somefile.txt'); $this->assertEquals($expected, $this->viewController->index('/whatever', '', '123')); diff --git a/apps/files/tests/HelperTest.php b/apps/files/tests/HelperTest.php index 979894ec0c6..74dad8b6f31 100644 --- a/apps/files/tests/HelperTest.php +++ b/apps/files/tests/HelperTest.php @@ -36,13 +36,13 @@ class HelperTest extends \Test\TestCase { '/' . $name, null, '/', - array( + [ 'name' => $name, 'size' => $size, 'mtime' => $mtime, 'type' => $isDir ? 'dir' : 'file', 'mimetype' => $isDir ? 'httpd/unix-directory' : 'application/octet-stream' - ), + ], null ); } @@ -51,49 +51,49 @@ class HelperTest extends \Test\TestCase { * Returns a file list for testing */ private function getTestFileList() { - return array( + return [ self::makeFileInfo('a.txt', 4, 2.3 * pow(10, 9)), self::makeFileInfo('q.txt', 5, 150), self::makeFileInfo('subdir2', 87, 128, true), self::makeFileInfo('b.txt', 2.2 * pow(10, 9), 800), self::makeFileInfo('o.txt', 12, 100), self::makeFileInfo('subdir', 88, 125, true), - ); + ]; } function sortDataProvider() { - return array( - array( + return [ + [ 'name', false, - array('subdir', 'subdir2', 'a.txt', 'b.txt', 'o.txt', 'q.txt'), - ), - array( + ['subdir', 'subdir2', 'a.txt', 'b.txt', 'o.txt', 'q.txt'], + ], + [ 'name', true, - array('q.txt', 'o.txt', 'b.txt', 'a.txt', 'subdir2', 'subdir'), - ), - array( + ['q.txt', 'o.txt', 'b.txt', 'a.txt', 'subdir2', 'subdir'], + ], + [ 'size', false, - array('a.txt', 'q.txt', 'o.txt', 'subdir2', 'subdir', 'b.txt'), - ), - array( + ['a.txt', 'q.txt', 'o.txt', 'subdir2', 'subdir', 'b.txt'], + ], + [ 'size', true, - array('b.txt', 'subdir', 'subdir2', 'o.txt', 'q.txt', 'a.txt'), - ), - array( + ['b.txt', 'subdir', 'subdir2', 'o.txt', 'q.txt', 'a.txt'], + ], + [ 'mtime', false, - array('o.txt', 'subdir', 'subdir2', 'q.txt', 'b.txt', 'a.txt'), - ), - array( + ['o.txt', 'subdir', 'subdir2', 'q.txt', 'b.txt', 'a.txt'], + ], + [ 'mtime', true, - array('a.txt', 'b.txt', 'q.txt', 'subdir2', 'subdir', 'o.txt'), - ), - ); + ['a.txt', 'b.txt', 'q.txt', 'subdir2', 'subdir', 'o.txt'], + ], + ]; } /** @@ -102,7 +102,7 @@ class HelperTest extends \Test\TestCase { public function testSortByName($sort, $sortDescending, $expectedOrder) { $files = self::getTestFileList(); $files = \OCA\Files\Helper::sortFiles($files, $sort, $sortDescending); - $fileNames = array(); + $fileNames = []; foreach ($files as $fileInfo) { $fileNames[] = $fileInfo->getName(); } diff --git a/apps/files/tests/Service/TagServiceTest.php b/apps/files/tests/Service/TagServiceTest.php index 7366c926b90..a2792a38647 100644 --- a/apps/files/tests/Service/TagServiceTest.php +++ b/apps/files/tests/Service/TagServiceTest.php @@ -85,7 +85,7 @@ class TagServiceTest extends \Test\TestCase { $this->userSession->expects($this->any()) ->method('getUser') ->withAnyParameters() - ->will($this->returnValue($user)); + ->willReturn($user); $this->root = \OC::$server->getUserFolder(); $this->dispatcher = $this->createMock(EventDispatcherInterface::class); @@ -132,25 +132,25 @@ class TagServiceTest extends \Test\TestCase { $fileId = $testFile->getId(); // set tags - $this->tagService->updateFileTags('subdir/test.txt', array($tag1, $tag2)); + $this->tagService->updateFileTags('subdir/test.txt', [$tag1, $tag2]); - $this->assertEquals(array($fileId), $this->tagger->getIdsForTag($tag1)); - $this->assertEquals(array($fileId), $this->tagger->getIdsForTag($tag2)); + $this->assertEquals([$fileId], $this->tagger->getIdsForTag($tag1)); + $this->assertEquals([$fileId], $this->tagger->getIdsForTag($tag2)); // remove tag - $this->tagService->updateFileTags('subdir/test.txt', array($tag2)); - $this->assertEquals(array(), $this->tagger->getIdsForTag($tag1)); - $this->assertEquals(array($fileId), $this->tagger->getIdsForTag($tag2)); + $this->tagService->updateFileTags('subdir/test.txt', [$tag2]); + $this->assertEquals([], $this->tagger->getIdsForTag($tag1)); + $this->assertEquals([$fileId], $this->tagger->getIdsForTag($tag2)); // clear tags - $this->tagService->updateFileTags('subdir/test.txt', array()); - $this->assertEquals(array(), $this->tagger->getIdsForTag($tag1)); - $this->assertEquals(array(), $this->tagger->getIdsForTag($tag2)); + $this->tagService->updateFileTags('subdir/test.txt', []); + $this->assertEquals([], $this->tagger->getIdsForTag($tag1)); + $this->assertEquals([], $this->tagger->getIdsForTag($tag2)); // non-existing file $caught = false; try { - $this->tagService->updateFileTags('subdir/unexist.txt', array($tag1)); + $this->tagService->updateFileTags('subdir/unexist.txt', [$tag1]); } catch (\OCP\Files\NotFoundException $e) { $caught = true; } |