summaryrefslogtreecommitdiffstats
path: root/apps/files_versions/tests
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-26 09:30:18 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-26 16:34:56 +0100
commitb80ebc96748b45fd2e0ba9323308657c4b00b7ec (patch)
treeec20e0ffa2f86b9b54939a83a785407319f94559 /apps/files_versions/tests
parent62403d0932be7d620c7bdadc6b4e13eb496fcd6f (diff)
downloadnextcloud-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_versions/tests')
-rw-r--r--apps/files_versions/tests/Command/CleanupTest.php8
-rw-r--r--apps/files_versions/tests/VersioningTest.php190
2 files changed, 99 insertions, 99 deletions
diff --git a/apps/files_versions/tests/Command/CleanupTest.php b/apps/files_versions/tests/Command/CleanupTest.php
index b5ed6c33a07..94f54f96d89 100644
--- a/apps/files_versions/tests/Command/CleanupTest.php
+++ b/apps/files_versions/tests/Command/CleanupTest.php
@@ -90,10 +90,10 @@ class CleanupTest extends TestCase {
}
public function dataTestDeleteVersions() {
- return array(
- array(true),
- array(false)
- );
+ return [
+ [true],
+ [false]
+ ];
}
diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php
index 53179bd6b30..c7eaec0a699 100644
--- a/apps/files_versions/tests/VersioningTest.php
+++ b/apps/files_versions/tests/VersioningTest.php
@@ -159,121 +159,121 @@ class VersioningTest extends \Test\TestCase {
}
public function versionsProvider() {
- return array(
+ return [
// first set of versions uniformly distributed versions
- array(
- array(
+ [
+ [
// first slice (10sec) keep one version every 2 seconds
- array("version" => 4999999, "path" => "keep", "size" => 1),
- array("version" => 4999998, "path" => "delete", "size" => 1),
- array("version" => 4999997, "path" => "keep", "size" => 1),
- array("version" => 4999995, "path" => "keep", "size" => 1),
- array("version" => 4999994, "path" => "delete", "size" => 1),
+ ["version" => 4999999, "path" => "keep", "size" => 1],
+ ["version" => 4999998, "path" => "delete", "size" => 1],
+ ["version" => 4999997, "path" => "keep", "size" => 1],
+ ["version" => 4999995, "path" => "keep", "size" => 1],
+ ["version" => 4999994, "path" => "delete", "size" => 1],
//next slice (60sec) starts at 4999990 keep one version every 10 secons
- array("version" => 4999988, "path" => "keep", "size" => 1),
- array("version" => 4999978, "path" => "keep", "size" => 1),
- array("version" => 4999975, "path" => "delete", "size" => 1),
- array("version" => 4999972, "path" => "delete", "size" => 1),
- array("version" => 4999967, "path" => "keep", "size" => 1),
- array("version" => 4999958, "path" => "delete", "size" => 1),
- array("version" => 4999957, "path" => "keep", "size" => 1),
+ ["version" => 4999988, "path" => "keep", "size" => 1],
+ ["version" => 4999978, "path" => "keep", "size" => 1],
+ ["version" => 4999975, "path" => "delete", "size" => 1],
+ ["version" => 4999972, "path" => "delete", "size" => 1],
+ ["version" => 4999967, "path" => "keep", "size" => 1],
+ ["version" => 4999958, "path" => "delete", "size" => 1],
+ ["version" => 4999957, "path" => "keep", "size" => 1],
//next slice (3600sec) start at 4999940 keep one version every 60 seconds
- array("version" => 4999900, "path" => "keep", "size" => 1),
- array("version" => 4999841, "path" => "delete", "size" => 1),
- array("version" => 4999840, "path" => "keep", "size" => 1),
- array("version" => 4999780, "path" => "keep", "size" => 1),
- array("version" => 4996401, "path" => "keep", "size" => 1),
+ ["version" => 4999900, "path" => "keep", "size" => 1],
+ ["version" => 4999841, "path" => "delete", "size" => 1],
+ ["version" => 4999840, "path" => "keep", "size" => 1],
+ ["version" => 4999780, "path" => "keep", "size" => 1],
+ ["version" => 4996401, "path" => "keep", "size" => 1],
// next slice (86400sec) start at 4996400 keep one version every 3600 seconds
- array("version" => 4996350, "path" => "delete", "size" => 1),
- array("version" => 4992800, "path" => "keep", "size" => 1),
- array("version" => 4989800, "path" => "delete", "size" => 1),
- array("version" => 4989700, "path" => "delete", "size" => 1),
- array("version" => 4989200, "path" => "keep", "size" => 1),
+ ["version" => 4996350, "path" => "delete", "size" => 1],
+ ["version" => 4992800, "path" => "keep", "size" => 1],
+ ["version" => 4989800, "path" => "delete", "size" => 1],
+ ["version" => 4989700, "path" => "delete", "size" => 1],
+ ["version" => 4989200, "path" => "keep", "size" => 1],
// next slice (2592000sec) start at 4913600 keep one version every 86400 seconds
- array("version" => 4913600, "path" => "keep", "size" => 1),
- array("version" => 4852800, "path" => "delete", "size" => 1),
- array("version" => 4827201, "path" => "delete", "size" => 1),
- array("version" => 4827200, "path" => "keep", "size" => 1),
- array("version" => 4777201, "path" => "delete", "size" => 1),
- array("version" => 4777501, "path" => "delete", "size" => 1),
- array("version" => 4740000, "path" => "keep", "size" => 1),
+ ["version" => 4913600, "path" => "keep", "size" => 1],
+ ["version" => 4852800, "path" => "delete", "size" => 1],
+ ["version" => 4827201, "path" => "delete", "size" => 1],
+ ["version" => 4827200, "path" => "keep", "size" => 1],
+ ["version" => 4777201, "path" => "delete", "size" => 1],
+ ["version" => 4777501, "path" => "delete", "size" => 1],
+ ["version" => 4740000, "path" => "keep", "size" => 1],
// final slice starts at 2408000 keep one version every 604800 secons
- array("version" => 2408000, "path" => "keep", "size" => 1),
- array("version" => 1803201, "path" => "delete", "size" => 1),
- array("version" => 1803200, "path" => "keep", "size" => 1),
- array("version" => 1800199, "path" => "delete", "size" => 1),
- array("version" => 1800100, "path" => "delete", "size" => 1),
- array("version" => 1198300, "path" => "keep", "size" => 1),
- ),
+ ["version" => 2408000, "path" => "keep", "size" => 1],
+ ["version" => 1803201, "path" => "delete", "size" => 1],
+ ["version" => 1803200, "path" => "keep", "size" => 1],
+ ["version" => 1800199, "path" => "delete", "size" => 1],
+ ["version" => 1800100, "path" => "delete", "size" => 1],
+ ["version" => 1198300, "path" => "keep", "size" => 1],
+ ],
16 // size of all deleted files (every file has the size 1)
- ),
+ ],
// second set of versions, here we have only really old versions
- array(
- array(
+ [
+ [
// first slice (10sec) keep one version every 2 seconds
// next slice (60sec) starts at 4999990 keep one version every 10 secons
// next slice (3600sec) start at 4999940 keep one version every 60 seconds
// next slice (86400sec) start at 4996400 keep one version every 3600 seconds
- array("version" => 4996400, "path" => "keep", "size" => 1),
- array("version" => 4996350, "path" => "delete", "size" => 1),
- array("version" => 4996350, "path" => "delete", "size" => 1),
- array("version" => 4992800, "path" => "keep", "size" => 1),
- array("version" => 4989800, "path" => "delete", "size" => 1),
- array("version" => 4989700, "path" => "delete", "size" => 1),
- array("version" => 4989200, "path" => "keep", "size" => 1),
+ ["version" => 4996400, "path" => "keep", "size" => 1],
+ ["version" => 4996350, "path" => "delete", "size" => 1],
+ ["version" => 4996350, "path" => "delete", "size" => 1],
+ ["version" => 4992800, "path" => "keep", "size" => 1],
+ ["version" => 4989800, "path" => "delete", "size" => 1],
+ ["version" => 4989700, "path" => "delete", "size" => 1],
+ ["version" => 4989200, "path" => "keep", "size" => 1],
// next slice (2592000sec) start at 4913600 keep one version every 86400 seconds
- array("version" => 4913600, "path" => "keep", "size" => 1),
- array("version" => 4852800, "path" => "delete", "size" => 1),
- array("version" => 4827201, "path" => "delete", "size" => 1),
- array("version" => 4827200, "path" => "keep", "size" => 1),
- array("version" => 4777201, "path" => "delete", "size" => 1),
- array("version" => 4777501, "path" => "delete", "size" => 1),
- array("version" => 4740000, "path" => "keep", "size" => 1),
+ ["version" => 4913600, "path" => "keep", "size" => 1],
+ ["version" => 4852800, "path" => "delete", "size" => 1],
+ ["version" => 4827201, "path" => "delete", "size" => 1],
+ ["version" => 4827200, "path" => "keep", "size" => 1],
+ ["version" => 4777201, "path" => "delete", "size" => 1],
+ ["version" => 4777501, "path" => "delete", "size" => 1],
+ ["version" => 4740000, "path" => "keep", "size" => 1],
// final slice starts at 2408000 keep one version every 604800 secons
- array("version" => 2408000, "path" => "keep", "size" => 1),
- array("version" => 1803201, "path" => "delete", "size" => 1),
- array("version" => 1803200, "path" => "keep", "size" => 1),
- array("version" => 1800199, "path" => "delete", "size" => 1),
- array("version" => 1800100, "path" => "delete", "size" => 1),
- array("version" => 1198300, "path" => "keep", "size" => 1),
- ),
+ ["version" => 2408000, "path" => "keep", "size" => 1],
+ ["version" => 1803201, "path" => "delete", "size" => 1],
+ ["version" => 1803200, "path" => "keep", "size" => 1],
+ ["version" => 1800199, "path" => "delete", "size" => 1],
+ ["version" => 1800100, "path" => "delete", "size" => 1],
+ ["version" => 1198300, "path" => "keep", "size" => 1],
+ ],
11 // size of all deleted files (every file has the size 1)
- ),
+ ],
// third set of versions, with some gaps between
- array(
- array(
+ [
+ [
// first slice (10sec) keep one version every 2 seconds
- array("version" => 4999999, "path" => "keep", "size" => 1),
- array("version" => 4999998, "path" => "delete", "size" => 1),
- array("version" => 4999997, "path" => "keep", "size" => 1),
- array("version" => 4999995, "path" => "keep", "size" => 1),
- array("version" => 4999994, "path" => "delete", "size" => 1),
+ ["version" => 4999999, "path" => "keep", "size" => 1],
+ ["version" => 4999998, "path" => "delete", "size" => 1],
+ ["version" => 4999997, "path" => "keep", "size" => 1],
+ ["version" => 4999995, "path" => "keep", "size" => 1],
+ ["version" => 4999994, "path" => "delete", "size" => 1],
//next slice (60sec) starts at 4999990 keep one version every 10 secons
- array("version" => 4999988, "path" => "keep", "size" => 1),
- array("version" => 4999978, "path" => "keep", "size" => 1),
+ ["version" => 4999988, "path" => "keep", "size" => 1],
+ ["version" => 4999978, "path" => "keep", "size" => 1],
//next slice (3600sec) start at 4999940 keep one version every 60 seconds
// next slice (86400sec) start at 4996400 keep one version every 3600 seconds
- array("version" => 4989200, "path" => "keep", "size" => 1),
+ ["version" => 4989200, "path" => "keep", "size" => 1],
// next slice (2592000sec) start at 4913600 keep one version every 86400 seconds
- array("version" => 4913600, "path" => "keep", "size" => 1),
- array("version" => 4852800, "path" => "delete", "size" => 1),
- array("version" => 4827201, "path" => "delete", "size" => 1),
- array("version" => 4827200, "path" => "keep", "size" => 1),
- array("version" => 4777201, "path" => "delete", "size" => 1),
- array("version" => 4777501, "path" => "delete", "size" => 1),
- array("version" => 4740000, "path" => "keep", "size" => 1),
+ ["version" => 4913600, "path" => "keep", "size" => 1],
+ ["version" => 4852800, "path" => "delete", "size" => 1],
+ ["version" => 4827201, "path" => "delete", "size" => 1],
+ ["version" => 4827200, "path" => "keep", "size" => 1],
+ ["version" => 4777201, "path" => "delete", "size" => 1],
+ ["version" => 4777501, "path" => "delete", "size" => 1],
+ ["version" => 4740000, "path" => "keep", "size" => 1],
// final slice starts at 2408000 keep one version every 604800 secons
- array("version" => 2408000, "path" => "keep", "size" => 1),
- array("version" => 1803201, "path" => "delete", "size" => 1),
- array("version" => 1803200, "path" => "keep", "size" => 1),
- array("version" => 1800199, "path" => "delete", "size" => 1),
- array("version" => 1800100, "path" => "delete", "size" => 1),
- array("version" => 1198300, "path" => "keep", "size" => 1),
- ),
+ ["version" => 2408000, "path" => "keep", "size" => 1],
+ ["version" => 1803201, "path" => "delete", "size" => 1],
+ ["version" => 1803200, "path" => "keep", "size" => 1],
+ ["version" => 1800199, "path" => "delete", "size" => 1],
+ ["version" => 1800100, "path" => "delete", "size" => 1],
+ ["version" => 1198300, "path" => "keep", "size" => 1],
+ ],
9 // size of all deleted files (every file has the size 1)
- ),
+ ],
- );
+ ];
}
public function testRename() {
@@ -647,8 +647,8 @@ class VersioningTest extends \Test\TestCase {
}
public function testRestoreCrossStorage() {
- $storage2 = new Temporary(array());
- \OC\Files\Filesystem::mount($storage2, array(), self::TEST_VERSIONS_USER . '/files/sub');
+ $storage2 = new Temporary([]);
+ \OC\Files\Filesystem::mount($storage2, [], self::TEST_VERSIONS_USER . '/files/sub');
$this->doTestRestore();
}
@@ -787,13 +787,13 @@ class VersioningTest extends \Test\TestCase {
$this->assertEquals('test file', $this->rootView->file_get_contents($filePath));
$info1 = $this->rootView->getFileInfo($filePath);
- $params = array();
+ $params = [];
$this->connectMockHooks('rollback', $params);
$this->assertTrue(\OCA\Files_Versions\Storage::rollback('sub/test.txt', $t2, $this->user1));
- $expectedParams = array(
+ $expectedParams = [
'path' => '/sub/test.txt',
- );
+ ];
$this->assertEquals($expectedParams['path'], $params['path']);
$this->assertTrue(array_key_exists('revision', $params));