diff options
Diffstat (limited to 'apps/files_versions/tests/VersioningTest.php')
-rw-r--r-- | apps/files_versions/tests/VersioningTest.php | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php index eaa0a02e261..659b2cff10c 100644 --- a/apps/files_versions/tests/VersioningTest.php +++ b/apps/files_versions/tests/VersioningTest.php @@ -1,4 +1,6 @@ <?php + +declare(strict_types=1); /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -163,7 +165,7 @@ class VersioningTest extends \Test\TestCase { } } - public function versionsProvider() { + public static function versionsProvider(): array { return [ // first set of versions uniformly distributed versions [ @@ -683,7 +685,7 @@ class VersioningTest extends \Test\TestCase { $firstVersion = current($versions); - $this->assertFalse(Storage::rollback('folder/test.txt', $firstVersion['version'], $this->user2), 'Revert did not happen'); + $this->assertFalse(Storage::rollback('folder/test.txt', (int)$firstVersion['version'], $this->user2), 'Revert did not happen'); $this->loginAsUser(self::TEST_VERSIONS_USER); @@ -743,8 +745,8 @@ class VersioningTest extends \Test\TestCase { return; } - $eventHandler = $this->getMockBuilder(\stdclass::class) - ->setMethods(['callback']) + $eventHandler = $this->getMockBuilder(DummyHookListener::class) + ->onlyMethods(['callback']) ->getMock(); $eventHandler->expects($this->any()) @@ -763,7 +765,7 @@ class VersioningTest extends \Test\TestCase { ); } - private function doTestRestore() { + private function doTestRestore(): void { $filePath = self::TEST_VERSIONS_USER . '/files/sub/test.txt'; $this->rootView->file_put_contents($filePath, 'test file'); @@ -941,11 +943,7 @@ class VersioningTest extends \Test\TestCase { ); } - /** - * @param View $view - * @param string $path - */ - private function createAndCheckVersions(View $view, $path) { + private function createAndCheckVersions(View $view, string $path): array { $view->file_put_contents($path, 'test file'); $view->file_put_contents($path, 'version 1'); $view->file_put_contents($path, 'version 2'); @@ -967,11 +965,7 @@ class VersioningTest extends \Test\TestCase { return $versions; } - /** - * @param string $user - * @param bool $create - */ - public static function loginHelper($user, $create = false) { + public static function loginHelper(string $user, bool $create = false) { if ($create) { $backend = new \Test\Util\User\Dummy(); $backend->createUser($user, $user); @@ -987,6 +981,11 @@ class VersioningTest extends \Test\TestCase { } } +class DummyHookListener { + public function callback() { + } +} + // extend the original class to make it possible to test protected methods class VersionStorageToTest extends Storage { |