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/files/tests | |
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/files/tests')
-rw-r--r-- | apps/files/tests/HelperTest.php | 50 | ||||
-rw-r--r-- | apps/files/tests/Service/TagServiceTest.php | 20 |
2 files changed, 35 insertions, 35 deletions
diff --git a/apps/files/tests/HelperTest.php b/apps/files/tests/HelperTest.php index b756386a2bf..8dda7be5a19 100644 --- a/apps/files/tests/HelperTest.php +++ b/apps/files/tests/HelperTest.php @@ -37,13 +37,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 ); } @@ -52,49 +52,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'], + ], + ]; } /** @@ -103,7 +103,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 bc7c803953b..a2792a38647 100644 --- a/apps/files/tests/Service/TagServiceTest.php +++ b/apps/files/tests/Service/TagServiceTest.php @@ -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; } |