aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2024-09-15 22:32:31 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2024-09-15 22:32:31 +0200
commit49dd79eabb2b8902559a7a4e8f8fcad54f46b604 (patch)
tree2af18db46ba463368dc4461d7436fb69577923de /apps/files_versions
parent4281ce6fa1bb8235426099d720734d2394bec203 (diff)
downloadnextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.tar.gz
nextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.zip
refactor: Add void return type to PHPUnit test methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/tests/Command/CleanupTest.php6
-rw-r--r--apps/files_versions/tests/Command/ExpireTest.php2
-rw-r--r--apps/files_versions/tests/Controller/PreviewControllerTest.php12
-rw-r--r--apps/files_versions/tests/ExpirationTest.php2
-rw-r--r--apps/files_versions/tests/StorageTest.php2
-rw-r--r--apps/files_versions/tests/VersioningTest.php38
-rw-r--r--apps/files_versions/tests/Versions/VersionManagerTest.php8
7 files changed, 35 insertions, 35 deletions
diff --git a/apps/files_versions/tests/Command/CleanupTest.php b/apps/files_versions/tests/Command/CleanupTest.php
index cd397e4a098..021a47ed08d 100644
--- a/apps/files_versions/tests/Command/CleanupTest.php
+++ b/apps/files_versions/tests/Command/CleanupTest.php
@@ -52,7 +52,7 @@ class CleanupTest extends TestCase {
* @dataProvider dataTestDeleteVersions
* @param boolean $nodeExists
*/
- public function testDeleteVersions($nodeExists) {
+ public function testDeleteVersions($nodeExists): void {
$this->rootFolder->expects($this->once())
->method('nodeExists')
->with('/testUser/files_versions')
@@ -102,7 +102,7 @@ class CleanupTest extends TestCase {
/**
* test delete versions from users given as parameter
*/
- public function testExecuteDeleteListOfUsers() {
+ public function testExecuteDeleteListOfUsers(): void {
$userIds = ['user1', 'user2', 'user3'];
$instance = $this->getMockBuilder('OCA\Files_Versions\Command\CleanUp')
@@ -133,7 +133,7 @@ class CleanupTest extends TestCase {
/**
* test delete versions of all users
*/
- public function testExecuteAllUsers() {
+ public function testExecuteAllUsers(): void {
$userIds = [];
$backendUsers = ['user1', 'user2'];
diff --git a/apps/files_versions/tests/Command/ExpireTest.php b/apps/files_versions/tests/Command/ExpireTest.php
index ac1fc4ada7f..11f4eb2e2be 100644
--- a/apps/files_versions/tests/Command/ExpireTest.php
+++ b/apps/files_versions/tests/Command/ExpireTest.php
@@ -17,7 +17,7 @@ use Test\TestCase;
* @package OCA\Files_Versions\Tests\Command
*/
class ExpireTest extends TestCase {
- public function testExpireNonExistingUser() {
+ public function testExpireNonExistingUser(): void {
$command = new Expire($this->getUniqueID('test'), '');
$command->handle();
diff --git a/apps/files_versions/tests/Controller/PreviewControllerTest.php b/apps/files_versions/tests/Controller/PreviewControllerTest.php
index 1673a212f89..9899836bb88 100644
--- a/apps/files_versions/tests/Controller/PreviewControllerTest.php
+++ b/apps/files_versions/tests/Controller/PreviewControllerTest.php
@@ -71,35 +71,35 @@ class PreviewControllerTest extends TestCase {
);
}
- public function testInvalidFile() {
+ public function testInvalidFile(): void {
$res = $this->controller->getPreview('');
$expected = new DataResponse([], Http::STATUS_BAD_REQUEST);
$this->assertEquals($expected, $res);
}
- public function testInvalidWidth() {
+ public function testInvalidWidth(): void {
$res = $this->controller->getPreview('file', 0);
$expected = new DataResponse([], Http::STATUS_BAD_REQUEST);
$this->assertEquals($expected, $res);
}
- public function testInvalidHeight() {
+ public function testInvalidHeight(): void {
$res = $this->controller->getPreview('file', 10, 0);
$expected = new DataResponse([], Http::STATUS_BAD_REQUEST);
$this->assertEquals($expected, $res);
}
- public function testInvalidVersion() {
+ public function testInvalidVersion(): void {
$res = $this->controller->getPreview('file', 10, 0);
$expected = new DataResponse([], Http::STATUS_BAD_REQUEST);
$this->assertEquals($expected, $res);
}
- public function testValidPreview() {
+ public function testValidPreview(): void {
$userFolder = $this->createMock(Folder::class);
$userRoot = $this->createMock(Folder::class);
@@ -136,7 +136,7 @@ class PreviewControllerTest extends TestCase {
$this->assertEquals($expected, $res);
}
- public function testVersionNotFound() {
+ public function testVersionNotFound(): void {
$userFolder = $this->createMock(Folder::class);
$userRoot = $this->createMock(Folder::class);
diff --git a/apps/files_versions/tests/ExpirationTest.php b/apps/files_versions/tests/ExpirationTest.php
index a998d3a3e9a..ac8af7c093a 100644
--- a/apps/files_versions/tests/ExpirationTest.php
+++ b/apps/files_versions/tests/ExpirationTest.php
@@ -88,7 +88,7 @@ class ExpirationTest extends \Test\TestCase {
* @param bool $quotaExceeded
* @param string $expectedResult
*/
- public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult) {
+ public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult): void {
$mockedConfig = $this->getMockedConfig($retentionObligation);
$mockedTimeFactory = $this->getMockedTimeFactory($timeNow);
$mockedLogger = $this->createMock(LoggerInterface::class);
diff --git a/apps/files_versions/tests/StorageTest.php b/apps/files_versions/tests/StorageTest.php
index ead125e905c..e085729eddd 100644
--- a/apps/files_versions/tests/StorageTest.php
+++ b/apps/files_versions/tests/StorageTest.php
@@ -55,7 +55,7 @@ class StorageTest extends TestCase {
$file->touch($mtime);
}
- public function testExpireMaxAge() {
+ public function testExpireMaxAge(): void {
$this->userFolder->newFolder('folder1');
$this->userFolder->newFolder('folder1/sub1');
$this->userFolder->newFolder('folder2');
diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php
index 4b6820750a2..3200b5f784b 100644
--- a/apps/files_versions/tests/VersioningTest.php
+++ b/apps/files_versions/tests/VersioningTest.php
@@ -123,7 +123,7 @@ class VersioningTest extends \Test\TestCase {
* test expire logic
* @dataProvider versionsProvider
*/
- public function testGetExpireList($versions, $sizeOfAllDeletedFiles) {
+ public function testGetExpireList($versions, $sizeOfAllDeletedFiles): void {
// last interval end at 2592000
$startTime = 5000000;
@@ -269,7 +269,7 @@ class VersioningTest extends \Test\TestCase {
];
}
- public function testRename() {
+ public function testRename(): void {
\OC\Files\Filesystem::file_put_contents('test.txt', 'test file');
$t1 = time();
@@ -298,7 +298,7 @@ class VersioningTest extends \Test\TestCase {
$this->assertTrue($this->rootView->file_exists($v2Renamed), 'version 2 of renamed file exists');
}
- public function testRenameInSharedFolder() {
+ public function testRenameInSharedFolder(): void {
\OC\Files\Filesystem::mkdir('folder1');
\OC\Files\Filesystem::mkdir('folder1/folder2');
\OC\Files\Filesystem::file_put_contents('folder1/test.txt', 'test file');
@@ -348,7 +348,7 @@ class VersioningTest extends \Test\TestCase {
\OC::$server->getShareManager()->deleteShare($share);
}
- public function testMoveFolder() {
+ public function testMoveFolder(): void {
\OC\Files\Filesystem::mkdir('folder1');
\OC\Files\Filesystem::mkdir('folder2');
\OC\Files\Filesystem::file_put_contents('folder1/test.txt', 'test file');
@@ -381,7 +381,7 @@ class VersioningTest extends \Test\TestCase {
}
- public function testMoveFileIntoSharedFolderAsRecipient() {
+ public function testMoveFileIntoSharedFolderAsRecipient(): void {
\OC\Files\Filesystem::mkdir('folder1');
$fileInfo = \OC\Files\Filesystem::getFileInfo('folder1');
@@ -431,7 +431,7 @@ class VersioningTest extends \Test\TestCase {
\OC::$server->getShareManager()->deleteShare($share);
}
- public function testMoveFolderIntoSharedFolderAsRecipient() {
+ public function testMoveFolderIntoSharedFolderAsRecipient(): void {
\OC\Files\Filesystem::mkdir('folder1');
$node = \OC::$server->getUserFolder(self::TEST_VERSIONS_USER)->get('folder1');
@@ -482,7 +482,7 @@ class VersioningTest extends \Test\TestCase {
\OC::$server->getShareManager()->deleteShare($share);
}
- public function testRenameSharedFile() {
+ public function testRenameSharedFile(): void {
\OC\Files\Filesystem::file_put_contents('test.txt', 'test file');
$t1 = time();
@@ -531,7 +531,7 @@ class VersioningTest extends \Test\TestCase {
\OC::$server->getShareManager()->deleteShare($share);
}
- public function testCopy() {
+ public function testCopy(): void {
\OC\Files\Filesystem::file_put_contents('test.txt', 'test file');
$t1 = time();
@@ -564,7 +564,7 @@ class VersioningTest extends \Test\TestCase {
* test if we find all versions and if the versions array contain
* the correct 'path' and 'name'
*/
- public function testGetVersions() {
+ public function testGetVersions(): void {
$t1 = time();
// second version is two weeks older, this way we make sure that no
// version will be expired
@@ -597,7 +597,7 @@ class VersioningTest extends \Test\TestCase {
* test if we find all versions and if the versions array contain
* the correct 'path' and 'name'
*/
- public function testGetVersionsEmptyFile() {
+ public function testGetVersionsEmptyFile(): void {
// execute copy hook of versions app
$versions = \OCA\Files_Versions\Storage::getVersions(self::TEST_VERSIONS_USER, '');
$this->assertCount(0, $versions);
@@ -606,7 +606,7 @@ class VersioningTest extends \Test\TestCase {
$this->assertCount(0, $versions);
}
- public function testExpireNonexistingFile() {
+ public function testExpireNonexistingFile(): void {
$this->logout();
// needed to have a FS setup (the background job does this)
\OC_Util::setupFS(self::TEST_VERSIONS_USER);
@@ -615,7 +615,7 @@ class VersioningTest extends \Test\TestCase {
}
- public function testExpireNonexistingUser() {
+ public function testExpireNonexistingUser(): void {
$this->expectException(\OC\User\NoUserException::class);
$this->logout();
@@ -626,19 +626,19 @@ class VersioningTest extends \Test\TestCase {
$this->assertFalse(\OCA\Files_Versions\Storage::expire('test.txt', 'unexist'));
}
- public function testRestoreSameStorage() {
+ public function testRestoreSameStorage(): void {
\OC\Files\Filesystem::mkdir('sub');
$this->doTestRestore();
}
- public function testRestoreCrossStorage() {
+ public function testRestoreCrossStorage(): void {
$storage2 = new Temporary([]);
\OC\Files\Filesystem::mount($storage2, [], self::TEST_VERSIONS_USER . '/files/sub');
$this->doTestRestore();
}
- public function testRestoreNoPermission() {
+ public function testRestoreNoPermission(): void {
$this->loginAsUser(self::TEST_VERSIONS_USER);
$userHome = \OC::$server->getUserFolder(self::TEST_VERSIONS_USER);
@@ -673,7 +673,7 @@ class VersioningTest extends \Test\TestCase {
$this->assertEquals('test file', $file->getContent(), 'File content has not changed');
}
- public function testRestoreMovedShare() {
+ public function testRestoreMovedShare(): void {
$this->markTestSkipped('Unreliable test');
$this->loginAsUser(self::TEST_VERSIONS_USER);
@@ -864,7 +864,7 @@ class VersioningTest extends \Test\TestCase {
/**
* Test whether versions are created when overwriting as owner
*/
- public function testStoreVersionAsOwner() {
+ public function testStoreVersionAsOwner(): void {
$this->loginAsUser(self::TEST_VERSIONS_USER);
$this->createAndCheckVersions(
@@ -876,7 +876,7 @@ class VersioningTest extends \Test\TestCase {
/**
* Test whether versions are created when overwriting as share recipient
*/
- public function testStoreVersionAsRecipient() {
+ public function testStoreVersionAsRecipient(): void {
$this->loginAsUser(self::TEST_VERSIONS_USER);
\OC\Files\Filesystem::mkdir('folder');
@@ -909,7 +909,7 @@ class VersioningTest extends \Test\TestCase {
* is logged in. File modification must still be able to find
* the owner and create versions.
*/
- public function testStoreVersionAsAnonymous() {
+ public function testStoreVersionAsAnonymous(): void {
$this->logout();
// note: public link upload does this,
diff --git a/apps/files_versions/tests/Versions/VersionManagerTest.php b/apps/files_versions/tests/Versions/VersionManagerTest.php
index d621d67a6de..a50781b899d 100644
--- a/apps/files_versions/tests/Versions/VersionManagerTest.php
+++ b/apps/files_versions/tests/Versions/VersionManagerTest.php
@@ -29,7 +29,7 @@ class VersionManagerTest extends TestCase {
->getMock();
}
- public function testGetBackendSingle() {
+ public function testGetBackendSingle(): void {
$manager = new VersionManager();
$backend = $this->getBackend();
$manager->registerBackend(IStorage::class, $backend);
@@ -37,7 +37,7 @@ class VersionManagerTest extends TestCase {
$this->assertEquals($backend, $manager->getBackendForStorage($this->getStorage(Local::class)));
}
- public function testGetBackendMoreSpecific() {
+ public function testGetBackendMoreSpecific(): void {
$manager = new VersionManager();
$backend1 = $this->getBackend();
$backend2 = $this->getBackend();
@@ -47,7 +47,7 @@ class VersionManagerTest extends TestCase {
$this->assertEquals($backend2, $manager->getBackendForStorage($this->getStorage(Local::class)));
}
- public function testGetBackendNoUse() {
+ public function testGetBackendNoUse(): void {
$manager = new VersionManager();
$backend1 = $this->getBackend();
$backend2 = $this->getBackend(false);
@@ -57,7 +57,7 @@ class VersionManagerTest extends TestCase {
$this->assertEquals($backend1, $manager->getBackendForStorage($this->getStorage(Local::class)));
}
- public function testGetBackendMultiple() {
+ public function testGetBackendMultiple(): void {
$manager = new VersionManager();
$backend1 = $this->getBackend();
$backend2 = $this->getBackend(false);