diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-01-20 08:38:43 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-01-20 08:38:43 +0100 |
commit | 898d2923cce4e61e21a26fed06ad402452c0b3b1 (patch) | |
tree | e9f3b91311c880074ff317a45700e080340fece0 /apps/dav/tests/unit/Connector/Sabre | |
parent | 5e3a3c0c8faa45489aa6ac610728b4177501c198 (diff) | |
download | nextcloud-server-898d2923cce4e61e21a26fed06ad402452c0b3b1.tar.gz nextcloud-server-898d2923cce4e61e21a26fed06ad402452c0b3b1.zip |
chore(dav): Add void return type to test methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav/tests/unit/Connector/Sabre')
28 files changed, 173 insertions, 173 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php index d72e19e1641..72800b84253 100644 --- a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php @@ -83,7 +83,7 @@ class AuthTest extends TestCase { ); } - public function testIsDavAuthenticatedWithoutDavSession() { + public function testIsDavAuthenticatedWithoutDavSession(): void { $this->session ->expects($this->once()) ->method('get') @@ -93,7 +93,7 @@ class AuthTest extends TestCase { $this->assertFalse($this->invokePrivate($this->auth, 'isDavAuthenticated', ['MyTestUser'])); } - public function testIsDavAuthenticatedWithWrongDavSession() { + public function testIsDavAuthenticatedWithWrongDavSession(): void { $this->session ->expects($this->exactly(2)) ->method('get') @@ -103,7 +103,7 @@ class AuthTest extends TestCase { $this->assertFalse($this->invokePrivate($this->auth, 'isDavAuthenticated', ['MyTestUser'])); } - public function testIsDavAuthenticatedWithCorrectDavSession() { + public function testIsDavAuthenticatedWithCorrectDavSession(): void { $this->session ->expects($this->exactly(2)) ->method('get') @@ -113,7 +113,7 @@ class AuthTest extends TestCase { $this->assertTrue($this->invokePrivate($this->auth, 'isDavAuthenticated', ['MyTestUser'])); } - public function testValidateUserPassOfAlreadyDAVAuthenticatedUser() { + public function testValidateUserPassOfAlreadyDAVAuthenticatedUser(): void { $user = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -140,7 +140,7 @@ class AuthTest extends TestCase { $this->assertTrue($this->invokePrivate($this->auth, 'validateUserPass', ['MyTestUser', 'MyTestPassword'])); } - public function testValidateUserPassOfInvalidDAVAuthenticatedUser() { + public function testValidateUserPassOfInvalidDAVAuthenticatedUser(): void { $user = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -167,7 +167,7 @@ class AuthTest extends TestCase { $this->assertFalse($this->invokePrivate($this->auth, 'validateUserPass', ['MyTestUser', 'MyTestPassword'])); } - public function testValidateUserPassOfInvalidDAVAuthenticatedUserWithValidPassword() { + public function testValidateUserPassOfInvalidDAVAuthenticatedUserWithValidPassword(): void { $user = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() ->getMock(); @@ -203,7 +203,7 @@ class AuthTest extends TestCase { $this->assertTrue($this->invokePrivate($this->auth, 'validateUserPass', ['MyTestUser', 'MyTestPassword'])); } - public function testValidateUserPassWithInvalidPassword() { + public function testValidateUserPassWithInvalidPassword(): void { $this->userSession ->expects($this->once()) ->method('isLoggedIn') @@ -221,7 +221,7 @@ class AuthTest extends TestCase { } - public function testValidateUserPassWithPasswordLoginForbidden() { + public function testValidateUserPassWithPasswordLoginForbidden(): void { $this->expectException(\OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden::class); $this->userSession @@ -240,7 +240,7 @@ class AuthTest extends TestCase { $this->invokePrivate($this->auth, 'validateUserPass', ['MyTestUser', 'MyTestPassword']); } - public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGet() { + public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGet(): void { $request = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() ->getMock(); @@ -283,7 +283,7 @@ class AuthTest extends TestCase { $this->assertSame($expectedResponse, $response); } - public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenAndCorrectlyDavAuthenticated() { + public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenAndCorrectlyDavAuthenticated(): void { $request = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() ->getMock(); @@ -330,7 +330,7 @@ class AuthTest extends TestCase { } - public function testAuthenticateAlreadyLoggedInWithoutTwoFactorChallengePassed() { + public function testAuthenticateAlreadyLoggedInWithoutTwoFactorChallengePassed(): void { $this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class); $this->expectExceptionMessage('2FA challenge not passed.'); @@ -384,7 +384,7 @@ class AuthTest extends TestCase { } - public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenAndIncorrectlyDavAuthenticated() { + public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenAndIncorrectlyDavAuthenticated(): void { $this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class); $this->expectExceptionMessage('CSRF check not passed.'); @@ -433,7 +433,7 @@ class AuthTest extends TestCase { $this->auth->check($request, $response); } - public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGetAndDesktopClient() { + public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGetAndDesktopClient(): void { $request = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() ->getMock(); @@ -480,7 +480,7 @@ class AuthTest extends TestCase { $this->auth->check($request, $response); } - public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForGet() { + public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForGet(): void { $request = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() ->getMock(); @@ -515,7 +515,7 @@ class AuthTest extends TestCase { $this->assertEquals([true, 'principals/users/MyWrongDavUser'], $response); } - public function testAuthenticateAlreadyLoggedInWithCsrfTokenForGet() { + public function testAuthenticateAlreadyLoggedInWithCsrfTokenForGet(): void { $request = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() ->getMock(); @@ -550,7 +550,7 @@ class AuthTest extends TestCase { $this->assertEquals([true, 'principals/users/MyWrongDavUser'], $response); } - public function testAuthenticateNoBasicAuthenticateHeadersProvided() { + public function testAuthenticateNoBasicAuthenticateHeadersProvided(): void { $server = $this->getMockBuilder(Server::class) ->disableOriginalConstructor() ->getMock(); @@ -565,7 +565,7 @@ class AuthTest extends TestCase { } - public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjax() { + public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjax(): void { $this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class); $this->expectExceptionMessage('Cannot authenticate over ajax calls'); @@ -589,7 +589,7 @@ class AuthTest extends TestCase { $this->auth->check($httpRequest, $httpResponse); } - public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjaxButUserIsStillLoggedIn() { + public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjaxButUserIsStillLoggedIn(): void { /** @var \Sabre\HTTP\RequestInterface $httpRequest */ $httpRequest = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() @@ -631,7 +631,7 @@ class AuthTest extends TestCase { ); } - public function testAuthenticateValidCredentials() { + public function testAuthenticateValidCredentials(): void { $server = $this->getMockBuilder(Server::class) ->disableOriginalConstructor() ->getMock(); @@ -671,7 +671,7 @@ class AuthTest extends TestCase { $this->assertEquals([true, 'principals/users/MyTestUser'], $response); } - public function testAuthenticateInvalidCredentials() { + public function testAuthenticateInvalidCredentials(): void { $server = $this->getMockBuilder(Server::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php b/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php index 58a93b25447..bfc8d9f9c53 100644 --- a/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php @@ -60,11 +60,11 @@ class BearerAuthTest extends TestCase { ); } - public function testValidateBearerTokenNotLoggedIn() { + public function testValidateBearerTokenNotLoggedIn(): void { $this->assertFalse($this->bearerAuth->validateBearerToken('Token')); } - public function testValidateBearerToken() { + public function testValidateBearerToken(): void { $this->userSession ->expects($this->exactly(2)) ->method('isLoggedIn') @@ -85,7 +85,7 @@ class BearerAuthTest extends TestCase { $this->assertSame('principals/users/admin', $this->bearerAuth->validateBearerToken('Token')); } - public function testChallenge() { + public function testChallenge(): void { /** @var \PHPUnit\Framework\MockObject\MockObject|RequestInterface $request */ $request = $this->createMock(RequestInterface::class); /** @var \PHPUnit\Framework\MockObject\MockObject|ResponseInterface $response */ diff --git a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php index e9d43f77cca..e0a274321f0 100644 --- a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php @@ -67,7 +67,7 @@ class BlockLegacyClientPluginTest extends TestCase { * @dataProvider oldDesktopClientProvider * @param string $userAgent */ - public function testBeforeHandlerException($userAgent) { + public function testBeforeHandlerException($userAgent): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->expectExceptionMessage('Unsupported client version.'); @@ -105,7 +105,7 @@ class BlockLegacyClientPluginTest extends TestCase { * @dataProvider newAndAlternateDesktopClientProvider * @param string $userAgent */ - public function testBeforeHandlerSuccess($userAgent) { + public function testBeforeHandlerSuccess($userAgent): void { /** @var \Sabre\HTTP\RequestInterface | \PHPUnit\Framework\MockObject\MockObject $request */ $request = $this->createMock('\Sabre\HTTP\RequestInterface'); $request @@ -123,7 +123,7 @@ class BlockLegacyClientPluginTest extends TestCase { $this->blockLegacyClientVersionPlugin->beforeHandler($request); } - public function testBeforeHandlerNoUserAgent() { + public function testBeforeHandlerNoUserAgent(): void { /** @var \Sabre\HTTP\RequestInterface | \PHPUnit\Framework\MockObject\MockObject $request */ $request = $this->createMock('\Sabre\HTTP\RequestInterface'); $request diff --git a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php index ea49cef5d0f..29d1aecfdeb 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php @@ -78,7 +78,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase { * @param $node * @param $expectedSuccessful */ - public function testHandleGetProperties($node, $expectedSuccessful) { + public function testHandleGetProperties($node, $expectedSuccessful): void { $propFind = $this->getMockBuilder(PropFind::class) ->disableOriginalConstructor() ->getMock(); @@ -108,7 +108,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase { * @param $fid * @param $expectedHref */ - public function testGetCommentsLink($baseUri, $fid, $expectedHref) { + public function testGetCommentsLink($baseUri, $fid, $expectedHref): void { $node = $this->getMockBuilder(File::class) ->disableOriginalConstructor() ->getMock(); @@ -139,7 +139,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase { * @dataProvider userProvider * @param $user */ - public function testGetUnreadCount($user) { + public function testGetUnreadCount($user): void { $node = $this->getMockBuilder(File::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php index 858e5c8199b..48ff61b80da 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php @@ -57,7 +57,7 @@ class CopyEtagHeaderPluginTest extends TestCase { $this->plugin->initialize($this->server); } - public function testCopyEtag() { + public function testCopyEtag(): void { $request = new \Sabre\Http\Request('GET', 'dummy.file'); $response = new \Sabre\Http\Response(); $response->setHeader('Etag', 'abcd'); @@ -67,7 +67,7 @@ class CopyEtagHeaderPluginTest extends TestCase { $this->assertEquals('abcd', $response->getHeader('OC-Etag')); } - public function testNoopWhenEmpty() { + public function testNoopWhenEmpty(): void { $request = new \Sabre\Http\Request('GET', 'dummy.file'); $response = new \Sabre\Http\Response(); @@ -89,7 +89,7 @@ class CopyEtagHeaderPluginTest extends TestCase { // Nothing to assert, we are just testing if the exception is handled } - public function testAfterMove() { + public function testAfterMove(): void { $node = $this->getMockBuilder(File::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php index 48658f3ffa3..395c4a6a779 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php @@ -122,7 +122,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase { return $node; } - private function applyDefaultProps($path = '/dummypath') { + private function applyDefaultProps($path = '/dummypath'): void { // properties to set $propPatch = new \Sabre\DAV\PropPatch([ 'customprop' => 'value1', @@ -146,7 +146,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase { /** * Test that propFind on a missing file soft fails */ - public function testPropFindMissingFileSoftFail() { + public function testPropFindMissingFileSoftFail(): void { $propFind = new \Sabre\DAV\PropFind( '/dummypath', [ @@ -174,7 +174,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase { /** * Test setting/getting properties */ - public function testSetGetPropertiesForFile() { + public function testSetGetPropertiesForFile(): void { $this->applyDefaultProps(); $propFind = new \Sabre\DAV\PropFind( @@ -200,7 +200,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase { /** * Test getting properties from directory */ - public function testGetPropertiesForDirectory() { + public function testGetPropertiesForDirectory(): void { $this->applyDefaultProps('/dummypath'); $this->applyDefaultProps('/dummypath/test.txt'); @@ -247,7 +247,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase { /** * Test delete property */ - public function testDeleteProperty() { + public function testDeleteProperty(): void { $this->applyDefaultProps(); $propPatch = new \Sabre\DAV\PropPatch([ diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php index 1de82484ac4..edbe4278c3a 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php @@ -107,7 +107,7 @@ class DirectoryTest extends \Test\TestCase { } - public function testDeleteRootFolderFails() { + public function testDeleteRootFolderFails(): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->info->expects($this->any()) @@ -120,7 +120,7 @@ class DirectoryTest extends \Test\TestCase { } - public function testDeleteForbidden() { + public function testDeleteForbidden(): void { $this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class); // deletion allowed @@ -139,7 +139,7 @@ class DirectoryTest extends \Test\TestCase { } - public function testDeleteFolderWhenAllowed() { + public function testDeleteFolderWhenAllowed(): void { // deletion allowed $this->info->expects($this->once()) ->method('isDeletable') @@ -156,7 +156,7 @@ class DirectoryTest extends \Test\TestCase { } - public function testDeleteFolderFailsWhenNotAllowed() { + public function testDeleteFolderFailsWhenNotAllowed(): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->info->expects($this->once()) @@ -168,7 +168,7 @@ class DirectoryTest extends \Test\TestCase { } - public function testDeleteFolderThrowsWhenDeletionFailed() { + public function testDeleteFolderThrowsWhenDeletionFailed(): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); // deletion allowed @@ -186,7 +186,7 @@ class DirectoryTest extends \Test\TestCase { $dir->delete(); } - public function testGetChildren() { + public function testGetChildren(): void { $info1 = $this->getMockBuilder(FileInfo::class) ->disableOriginalConstructor() ->getMock(); @@ -226,7 +226,7 @@ class DirectoryTest extends \Test\TestCase { } - public function testGetChildrenNoPermission() { + public function testGetChildrenNoPermission(): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); $info = $this->createMock(FileInfo::class); @@ -239,7 +239,7 @@ class DirectoryTest extends \Test\TestCase { } - public function testGetChildNoPermission() { + public function testGetChildNoPermission(): void { $this->expectException(\Sabre\DAV\Exception\NotFound::class); $this->info->expects($this->any()) @@ -251,7 +251,7 @@ class DirectoryTest extends \Test\TestCase { } - public function testGetChildThrowStorageNotAvailableException() { + public function testGetChildThrowStorageNotAvailableException(): void { $this->expectException(\Sabre\DAV\Exception\ServiceUnavailable::class); $this->view->expects($this->once()) @@ -263,7 +263,7 @@ class DirectoryTest extends \Test\TestCase { } - public function testGetChildThrowInvalidPath() { + public function testGetChildThrowInvalidPath(): void { $this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class); $this->view->expects($this->once()) @@ -276,7 +276,7 @@ class DirectoryTest extends \Test\TestCase { $dir->getChild('.'); } - public function testGetQuotaInfoUnlimited() { + public function testGetQuotaInfoUnlimited(): void { self::createUser('user', 'password'); self::loginAsUser('user'); $mountPoint = $this->createMock(IMountPoint::class); @@ -319,7 +319,7 @@ class DirectoryTest extends \Test\TestCase { $this->assertEquals([200, -3], $dir->getQuotaInfo()); //200 used, unlimited } - public function testGetQuotaInfoSpecific() { + public function testGetQuotaInfoSpecific(): void { self::createUser('user', 'password'); self::loginAsUser('user'); $mountPoint = $this->createMock(IMountPoint::class); @@ -366,7 +366,7 @@ class DirectoryTest extends \Test\TestCase { /** * @dataProvider moveFailedProvider */ - public function testMoveFailed($source, $destination, $updatables, $deletables) { + public function testMoveFailed($source, $destination, $updatables, $deletables): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->moveTest($source, $destination, $updatables, $deletables); @@ -375,7 +375,7 @@ class DirectoryTest extends \Test\TestCase { /** * @dataProvider moveSuccessProvider */ - public function testMoveSuccess($source, $destination, $updatables, $deletables) { + public function testMoveSuccess($source, $destination, $updatables, $deletables): void { $this->moveTest($source, $destination, $updatables, $deletables); $this->addToAssertionCount(1); } @@ -383,7 +383,7 @@ class DirectoryTest extends \Test\TestCase { /** * @dataProvider moveFailedInvalidCharsProvider */ - public function testMoveFailedInvalidChars($source, $destination, $updatables, $deletables) { + public function testMoveFailedInvalidChars($source, $destination, $updatables, $deletables): void { $this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class); $this->moveTest($source, $destination, $updatables, $deletables); @@ -419,7 +419,7 @@ class DirectoryTest extends \Test\TestCase { * @param $destination * @param $updatables */ - private function moveTest($source, $destination, $updatables, $deletables) { + private function moveTest($source, $destination, $updatables, $deletables): void { $view = new TestViewDirectory($updatables, $deletables); $sourceInfo = new FileInfo($source, null, null, [ @@ -441,7 +441,7 @@ class DirectoryTest extends \Test\TestCase { } - public function testFailingMove() { + public function testFailingMove(): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->expectExceptionMessage('Could not copy directory b, target exists'); diff --git a/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php b/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php index c4b7ed15f2b..88f0acf97e4 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php @@ -46,7 +46,7 @@ class DummyGetResponsePluginTest extends TestCase { $this->dummyGetResponsePlugin = new DummyGetResponsePlugin(); } - public function testInitialize() { + public function testInitialize(): void { /** @var Server $server */ $server = $this->getMockBuilder(Server::class) ->disableOriginalConstructor() @@ -60,7 +60,7 @@ class DummyGetResponsePluginTest extends TestCase { } - public function testHttpGet() { + public function testHttpGet(): void { /** @var \Sabre\HTTP\RequestInterface $request */ $request = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() diff --git a/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php b/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php index 4d316bf870a..65a420589f0 100644 --- a/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php @@ -25,7 +25,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre\Exception; use OCA\DAV\Connector\Sabre\Exception\Forbidden; class ForbiddenTest extends \Test\TestCase { - public function testSerialization() { + public function testSerialization(): void { // create xml doc $DOM = new \DOMDocument('1.0','utf-8'); diff --git a/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php b/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php index 3c68d780ff3..f202bf573de 100644 --- a/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php @@ -26,7 +26,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre\Exception; use OCA\DAV\Connector\Sabre\Exception\InvalidPath; class InvalidPathTest extends \Test\TestCase { - public function testSerialization() { + public function testSerialization(): void { // create xml doc $DOM = new \DOMDocument('1.0','utf-8'); diff --git a/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php index a553c0687e0..c198df16f08 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php @@ -50,7 +50,7 @@ class ExceptionLoggerPluginTest extends TestCase { /** @var LoggerInterface | \PHPUnit\Framework\MockObject\MockObject */ private $logger; - private function init() { + private function init(): void { $config = $this->createMock(SystemConfig::class); $config->expects($this->any()) ->method('getValue') @@ -72,7 +72,7 @@ class ExceptionLoggerPluginTest extends TestCase { /** * @dataProvider providesExceptions */ - public function testLogging(string $expectedLogLevel, \Throwable $e) { + public function testLogging(string $expectedLogLevel, \Throwable $e): void { $this->init(); $this->logger->expects($this->once()) diff --git a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php index 9c7ca8e9329..099b84aa6b1 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php @@ -50,7 +50,7 @@ class FakeLockerPluginTest extends TestCase { $this->fakeLockerPlugin = new FakeLockerPlugin(); } - public function testInitialize() { + public function testInitialize(): void { /** @var Server $server */ $server = $this->getMockBuilder(Server::class) ->disableOriginalConstructor() @@ -68,7 +68,7 @@ class FakeLockerPluginTest extends TestCase { $this->fakeLockerPlugin->initialize($server); } - public function testGetHTTPMethods() { + public function testGetHTTPMethods(): void { $expected = [ 'LOCK', 'UNLOCK', @@ -76,14 +76,14 @@ class FakeLockerPluginTest extends TestCase { $this->assertSame($expected, $this->fakeLockerPlugin->getHTTPMethods('Test')); } - public function testGetFeatures() { + public function testGetFeatures(): void { $expected = [ 2, ]; $this->assertSame($expected, $this->fakeLockerPlugin->getFeatures()); } - public function testPropFind() { + public function testPropFind(): void { $propFind = $this->getMockBuilder(PropFind::class) ->disableOriginalConstructor() ->getMock(); @@ -143,7 +143,7 @@ class FakeLockerPluginTest extends TestCase { * @param array $input * @param array $expected */ - public function testValidateTokens(array $input, array $expected) { + public function testValidateTokens(array $input, array $expected): void { $request = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() ->getMock(); @@ -151,7 +151,7 @@ class FakeLockerPluginTest extends TestCase { $this->assertSame($expected, $input); } - public function testFakeLockProvider() { + public function testFakeLockProvider(): void { $request = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() ->getMock(); @@ -171,7 +171,7 @@ class FakeLockerPluginTest extends TestCase { $this->assertXmlStringEqualsXmlString($expectedXml, $response->getBody()); } - public function testFakeUnlockProvider() { + public function testFakeUnlockProvider(): void { $request = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php index 91e49d331e9..8d72fb13b78 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -178,7 +178,7 @@ class FileTest extends TestCase { /** * @dataProvider fopenFailuresProvider */ - public function testSimplePutFails($thrownException, $expectedException, $checkPreviousClass = true) { + public function testSimplePutFails($thrownException, $expectedException, $checkPreviousClass = true): void { // setup $storage = $this->getMockBuilder(Local::class) ->setMethods(['writeStream']) @@ -239,7 +239,7 @@ class FileTest extends TestCase { * * @dataProvider fopenFailuresProvider */ - public function testChunkedPutFails($thrownException, $expectedException, $checkPreviousClass = false) { + public function testChunkedPutFails($thrownException, $expectedException, $checkPreviousClass = false): void { // setup $storage = $this->getMockBuilder(Local::class) ->setMethods(['fopen']) @@ -357,7 +357,7 @@ class FileTest extends TestCase { /** * Test putting a single file */ - public function testPutSingleFile() { + public function testPutSingleFile(): void { $this->assertNotEmpty($this->doPut('/foo.txt')); } @@ -418,7 +418,7 @@ class FileTest extends TestCase { * Test putting a file with string Mtime * @dataProvider legalMtimeProvider */ - public function testPutSingleFileLegalMtime($requestMtime, $resultMtime) { + public function testPutSingleFileLegalMtime($requestMtime, $resultMtime): void { $request = new Request([ 'server' => [ 'HTTP_X_OC_MTIME' => $requestMtime, @@ -441,7 +441,7 @@ class FileTest extends TestCase { * Test putting a file with string Mtime using chunking * @dataProvider legalMtimeProvider */ - public function testChunkedPutLegalMtime($requestMtime, $resultMtime) { + public function testChunkedPutLegalMtime($requestMtime, $resultMtime): void { $request = new Request([ 'server' => [ 'HTTP_X_OC_MTIME' => $requestMtime, @@ -466,7 +466,7 @@ class FileTest extends TestCase { /** * Test putting a file using chunking */ - public function testChunkedPut() { + public function testChunkedPut(): void { $_SERVER['HTTP_OC_CHUNKED'] = true; $this->assertNull($this->doPut('/test.txt-chunking-12345-2-0')); $this->assertNotEmpty($this->doPut('/test.txt-chunking-12345-2-1')); @@ -475,7 +475,7 @@ class FileTest extends TestCase { /** * Test that putting a file triggers create hooks */ - public function testPutSingleFileTriggersHooks() { + public function testPutSingleFileTriggersHooks(): void { HookHelper::setUpHooks(); $this->assertNotEmpty($this->doPut('/foo.txt')); @@ -506,7 +506,7 @@ class FileTest extends TestCase { /** * Test that putting a file triggers update hooks */ - public function testPutOverwriteFileTriggersHooks() { + public function testPutOverwriteFileTriggersHooks(): void { $view = \OC\Files\Filesystem::getView(); $view->file_put_contents('/foo.txt', 'some content that will be replaced'); @@ -542,7 +542,7 @@ class FileTest extends TestCase { * if the passed view was chrooted (can happen with public webdav * where the root is the share root) */ - public function testPutSingleFileTriggersHooksDifferentRoot() { + public function testPutSingleFileTriggersHooksDifferentRoot(): void { $view = \OC\Files\Filesystem::getView(); $view->mkdir('noderoot'); @@ -577,7 +577,7 @@ class FileTest extends TestCase { /** * Test that putting a file with chunks triggers create hooks */ - public function testPutChunkedFileTriggersHooks() { + public function testPutChunkedFileTriggersHooks(): void { HookHelper::setUpHooks(); $_SERVER['HTTP_OC_CHUNKED'] = true; @@ -610,7 +610,7 @@ class FileTest extends TestCase { /** * Test that putting a chunked file triggers update hooks */ - public function testPutOverwriteChunkedFileTriggersHooks() { + public function testPutOverwriteChunkedFileTriggersHooks(): void { $view = \OC\Files\Filesystem::getView(); $view->file_put_contents('/foo.txt', 'some content that will be replaced'); @@ -643,7 +643,7 @@ class FileTest extends TestCase { ); } - public static function cancellingHook($params) { + public static function cancellingHook($params): void { self::$hookCalls[] = [ 'signal' => Filesystem::signal_post_create, 'params' => $params @@ -653,7 +653,7 @@ class FileTest extends TestCase { /** * Test put file with cancelled hook */ - public function testPutSingleFileCancelPreHook() { + public function testPutSingleFileCancelPreHook(): void { \OCP\Util::connectHook( Filesystem::CLASSNAME, Filesystem::signal_create, @@ -676,7 +676,7 @@ class FileTest extends TestCase { /** * Test exception when the uploaded size did not match */ - public function testSimplePutFailsSizeCheck() { + public function testSimplePutFailsSizeCheck(): void { // setup $view = $this->getMockBuilder(View::class) ->setMethods(['rename', 'getRelativePath', 'filesize']) @@ -724,7 +724,7 @@ class FileTest extends TestCase { /** * Test exception during final rename in simple upload mode */ - public function testSimplePutFailsMoveFromStorage() { + public function testSimplePutFailsMoveFromStorage(): void { $view = new \OC\Files\View('/' . $this->user . '/files'); // simulate situation where the target file is locked @@ -758,7 +758,7 @@ class FileTest extends TestCase { /** * Test exception during final rename in chunk upload mode */ - public function testChunkedPutFailsFinalRename() { + public function testChunkedPutFailsFinalRename(): void { $view = new \OC\Files\View('/' . $this->user . '/files'); // simulate situation where the target file is locked @@ -798,7 +798,7 @@ class FileTest extends TestCase { /** * Test put file with invalid chars */ - public function testSimplePutInvalidChars() { + public function testSimplePutInvalidChars(): void { // setup $view = $this->getMockBuilder(View::class) ->setMethods(['getRelativePath']) @@ -835,7 +835,7 @@ class FileTest extends TestCase { * Test setting name with setName() with invalid chars * */ - public function testSetNameInvalidChars() { + public function testSetNameInvalidChars(): void { $this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class); // setup @@ -856,7 +856,7 @@ class FileTest extends TestCase { } - public function testUploadAbort() { + public function testUploadAbort(): void { // setup $view = $this->getMockBuilder(View::class) ->setMethods(['rename', 'getRelativePath', 'filesize']) @@ -901,7 +901,7 @@ class FileTest extends TestCase { } - public function testDeleteWhenAllowed() { + public function testDeleteWhenAllowed(): void { // setup $view = $this->getMockBuilder(View::class) ->getMock(); @@ -922,7 +922,7 @@ class FileTest extends TestCase { } - public function testDeleteThrowsWhenDeletionNotAllowed() { + public function testDeleteThrowsWhenDeletionNotAllowed(): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); // setup @@ -941,7 +941,7 @@ class FileTest extends TestCase { } - public function testDeleteThrowsWhenDeletionFailed() { + public function testDeleteThrowsWhenDeletionFailed(): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); // setup @@ -965,7 +965,7 @@ class FileTest extends TestCase { } - public function testDeleteThrowsWhenDeletionThrows() { + public function testDeleteThrowsWhenDeletionThrows(): void { $this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class); // setup @@ -1007,7 +1007,7 @@ class FileTest extends TestCase { /** * Test whether locks are set before and after the operation */ - public function testPutLocking() { + public function testPutLocking(): void { $view = new \OC\Files\View('/' . $this->user . '/files/'); $path = 'test-locking.txt'; @@ -1044,7 +1044,7 @@ class FileTest extends TestCase { $eventHandler->expects($this->once()) ->method('writeCallback') ->willReturnCallback( - function () use ($view, $path, &$wasLockedPre) { + function () use ($view, $path, &$wasLockedPre): void { $wasLockedPre = $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED); $wasLockedPre = $wasLockedPre && !$this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE); } @@ -1052,7 +1052,7 @@ class FileTest extends TestCase { $eventHandler->expects($this->once()) ->method('postWriteCallback') ->willReturnCallback( - function () use ($view, $path, &$wasLockedPost) { + function () use ($view, $path, &$wasLockedPost): void { $wasLockedPost = $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED); $wasLockedPost = $wasLockedPost && !$this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE); } @@ -1139,7 +1139,7 @@ class FileTest extends TestCase { } - public function testGetFopenFails() { + public function testGetFopenFails(): void { $this->expectException(\Sabre\DAV\Exception\ServiceUnavailable::class); $view = $this->getMockBuilder(View::class) @@ -1160,7 +1160,7 @@ class FileTest extends TestCase { } - public function testGetFopenThrows() { + public function testGetFopenThrows(): void { $this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class); $view = $this->getMockBuilder(View::class) @@ -1181,7 +1181,7 @@ class FileTest extends TestCase { } - public function testGetThrowsIfNoPermission() { + public function testGetThrowsIfNoPermission(): void { $this->expectException(\Sabre\DAV\Exception\NotFound::class); $view = $this->getMockBuilder(View::class) @@ -1200,7 +1200,7 @@ class FileTest extends TestCase { $file->get(); } - public function testSimplePutNoCreatePermissions() { + public function testSimplePutNoCreatePermissions(): void { $this->logout(); $storage = new Temporary([]); @@ -1231,7 +1231,7 @@ class FileTest extends TestCase { $this->assertEquals('new content', $view->file_get_contents('root/file.txt')); } - public function testPutLockExpired() { + public function testPutLockExpired(): void { $view = new \OC\Files\View('/' . $this->user . '/files/'); $path = 'test-locking.txt'; diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php index 777a730ffd1..dfff9493762 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php @@ -180,7 +180,7 @@ class FilesPluginTest extends TestCase { return $node; } - public function testGetPropertiesForFile() { + public function testGetPropertiesForFile(): void { /** @var \OCA\DAV\Connector\Sabre\File | \PHPUnit\Framework\MockObject\MockObject $node */ $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); @@ -237,7 +237,7 @@ class FilesPluginTest extends TestCase { $this->assertEquals([self::SIZE_PROPERTYNAME], $propFind->get404Properties()); } - public function testGetPropertiesStorageNotAvailable() { + public function testGetPropertiesStorageNotAvailable(): void { /** @var \OCA\DAV\Connector\Sabre\File | \PHPUnit\Framework\MockObject\MockObject $node */ $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); @@ -261,7 +261,7 @@ class FilesPluginTest extends TestCase { $this->assertEquals(null, $propFind->get(self::DOWNLOADURL_PROPERTYNAME)); } - public function testGetPublicPermissions() { + public function testGetPublicPermissions(): void { $this->plugin = new FilesPlugin( $this->tree, $this->config, @@ -295,7 +295,7 @@ class FilesPluginTest extends TestCase { $this->assertEquals('DWCKR', $propFind->get(self::PERMISSIONS_PROPERTYNAME)); } - public function testGetPropertiesForDirectory() { + public function testGetPropertiesForDirectory(): void { /** @var \OCA\DAV\Connector\Sabre\Directory | \PHPUnit\Framework\MockObject\MockObject $node */ $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory'); @@ -330,7 +330,7 @@ class FilesPluginTest extends TestCase { $this->assertEquals([self::DOWNLOADURL_PROPERTYNAME], $propFind->get404Properties()); } - public function testGetPropertiesForRootDirectory() { + public function testGetPropertiesForRootDirectory(): void { /** @var \OCA\DAV\Connector\Sabre\Directory|\PHPUnit\Framework\MockObject\MockObject $node */ $node = $this->getMockBuilder(Directory::class) ->disableOriginalConstructor() @@ -362,7 +362,7 @@ class FilesPluginTest extends TestCase { $this->assertEquals('my_fingerprint', $propFind->get(self::DATA_FINGERPRINT_PROPERTYNAME)); } - public function testGetPropertiesWhenNoPermission() { + public function testGetPropertiesWhenNoPermission(): void { // No read permissions can be caused by files access control. // But we still want to load the directory list, so this is okay for us. // $this->expectException(\Sabre\DAV\Exception\NotFound::class); @@ -398,7 +398,7 @@ class FilesPluginTest extends TestCase { $this->addToAssertionCount(1); } - public function testUpdateProps() { + public function testUpdateProps(): void { $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); $testDate = 'Fri, 13 Feb 2015 00:01:02 GMT'; @@ -439,7 +439,7 @@ class FilesPluginTest extends TestCase { $this->assertEquals(200, $result[self::CREATIONDATE_PROPERTYNAME]); } - public function testUpdatePropsForbidden() { + public function testUpdatePropsForbidden(): void { $propPatch = new PropPatch([ self::OWNER_ID_PROPERTYNAME => 'user2', self::OWNER_DISPLAY_NAME_PROPERTYNAME => 'User Two', @@ -478,7 +478,7 @@ class FilesPluginTest extends TestCase { * Thus moving /FolderA/test.txt to /test.txt should fail already on that check * */ - public function testMoveSrcNotDeletable() { + public function testMoveSrcNotDeletable(): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); $this->expectExceptionMessage('FolderA/test.txt cannot be deleted'); @@ -502,7 +502,7 @@ class FilesPluginTest extends TestCase { $this->plugin->checkMove('FolderA/test.txt', 'test.txt'); } - public function testMoveSrcDeletable() { + public function testMoveSrcDeletable(): void { $fileInfoFolderATestTXT = $this->getMockBuilder(FileInfo::class) ->disableOriginalConstructor() ->getMock(); @@ -524,7 +524,7 @@ class FilesPluginTest extends TestCase { } - public function testMoveSrcNotExist() { + public function testMoveSrcNotExist(): void { $this->expectException(\Sabre\DAV\Exception\NotFound::class); $this->expectExceptionMessage('FolderA/test.txt does not exist'); @@ -557,7 +557,7 @@ class FilesPluginTest extends TestCase { /** * @dataProvider downloadHeadersProvider */ - public function testDownloadHeaders($isClumsyAgent, $contentDispositionHeader) { + public function testDownloadHeaders($isClumsyAgent, $contentDispositionHeader): void { $request = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() ->getMock(); @@ -600,7 +600,7 @@ class FilesPluginTest extends TestCase { $this->plugin->httpGet($request, $response); } - public function testHasPreview() { + public function testHasPreview(): void { /** @var \OCA\DAV\Connector\Sabre\Directory | \PHPUnit\Framework\MockObject\MockObject $node */ $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory'); diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php index 5b8ed304e96..d38031b03d4 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php @@ -153,7 +153,7 @@ class FilesReportPluginTest extends \Test\TestCase { ); } - public function testOnReportInvalidNode() { + public function testOnReportInvalidNode(): void { $path = 'totally/unrelated/13'; $this->tree->expects($this->any()) @@ -173,7 +173,7 @@ class FilesReportPluginTest extends \Test\TestCase { $this->assertNull($this->plugin->onReport(FilesReportPluginImplementation::REPORT_NAME, [], '/' . $path)); } - public function testOnReportInvalidReportName() { + public function testOnReportInvalidReportName(): void { $path = 'test'; $this->tree->expects($this->any()) @@ -193,7 +193,7 @@ class FilesReportPluginTest extends \Test\TestCase { $this->assertNull($this->plugin->onReport('{whoever}whatever', [], '/' . $path)); } - public function testOnReport() { + public function testOnReport(): void { $path = 'test'; $parameters = [ @@ -282,7 +282,7 @@ class FilesReportPluginTest extends \Test\TestCase { $this->assertFalse($this->plugin->onReport(FilesReportPluginImplementation::REPORT_NAME, $parameters, '/' . $path)); } - public function testFindNodesByFileIdsRoot() { + public function testFindNodesByFileIdsRoot(): void { $filesNode1 = $this->getMockBuilder(Folder::class) ->disableOriginalConstructor() ->getMock(); @@ -325,7 +325,7 @@ class FilesReportPluginTest extends \Test\TestCase { $this->assertEquals('second node', $result[1]->getName()); } - public function testFindNodesByFileIdsSubDir() { + public function testFindNodesByFileIdsSubDir(): void { $filesNode1 = $this->getMockBuilder(Folder::class) ->disableOriginalConstructor() ->getMock(); @@ -378,7 +378,7 @@ class FilesReportPluginTest extends \Test\TestCase { $this->assertEquals('second node', $result[1]->getName()); } - public function testPrepareResponses() { + public function testPrepareResponses(): void { $requestedProps = ['{DAV:}getcontentlength', '{http://owncloud.org/ns}fileid', '{DAV:}resourcetype']; $fileInfo = $this->createMock(FileInfo::class); @@ -447,7 +447,7 @@ class FilesReportPluginTest extends \Test\TestCase { $this->assertCount(0, $props2[200]['{DAV:}resourcetype']->getValue()); } - public function testProcessFilterRulesSingle() { + public function testProcessFilterRulesSingle(): void { $this->groupManager->expects($this->any()) ->method('isAdmin') ->willReturn(true); @@ -468,7 +468,7 @@ class FilesReportPluginTest extends \Test\TestCase { $this->assertEquals(['111', '222'], $this->invokePrivate($this->plugin, 'processFilterRules', [$rules])); } - public function testProcessFilterRulesAndCondition() { + public function testProcessFilterRulesAndCondition(): void { $this->groupManager->expects($this->any()) ->method('isAdmin') ->willReturn(true); @@ -492,7 +492,7 @@ class FilesReportPluginTest extends \Test\TestCase { $this->assertEquals(['222'], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules]))); } - public function testProcessFilterRulesAndConditionWithOneEmptyResult() { + public function testProcessFilterRulesAndConditionWithOneEmptyResult(): void { $this->groupManager->expects($this->any()) ->method('isAdmin') ->willReturn(true); @@ -516,7 +516,7 @@ class FilesReportPluginTest extends \Test\TestCase { $this->assertEquals([], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules]))); } - public function testProcessFilterRulesAndConditionWithFirstEmptyResult() { + public function testProcessFilterRulesAndConditionWithFirstEmptyResult(): void { $this->groupManager->expects($this->any()) ->method('isAdmin') ->willReturn(true); @@ -540,7 +540,7 @@ class FilesReportPluginTest extends \Test\TestCase { $this->assertEquals([], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules]))); } - public function testProcessFilterRulesAndConditionWithEmptyMidResult() { + public function testProcessFilterRulesAndConditionWithEmptyMidResult(): void { $this->groupManager->expects($this->any()) ->method('isAdmin') ->willReturn(true); @@ -567,7 +567,7 @@ class FilesReportPluginTest extends \Test\TestCase { $this->assertEquals([], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules]))); } - public function testProcessFilterRulesInvisibleTagAsAdmin() { + public function testProcessFilterRulesInvisibleTagAsAdmin(): void { $this->groupManager->expects($this->any()) ->method('isAdmin') ->willReturn(true); @@ -616,7 +616,7 @@ class FilesReportPluginTest extends \Test\TestCase { } - public function testProcessFilterRulesInvisibleTagAsUser() { + public function testProcessFilterRulesInvisibleTagAsUser(): void { $this->expectException(\OCP\SystemTag\TagNotFoundException::class); $this->groupManager->expects($this->any()) @@ -656,7 +656,7 @@ class FilesReportPluginTest extends \Test\TestCase { $this->invokePrivate($this->plugin, 'processFilterRules', [$rules]); } - public function testProcessFilterRulesVisibleTagAsUser() { + public function testProcessFilterRulesVisibleTagAsUser(): void { $this->groupManager->expects($this->any()) ->method('isAdmin') ->willReturn(false); @@ -705,7 +705,7 @@ class FilesReportPluginTest extends \Test\TestCase { $this->assertEquals(['222'], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules]))); } - public function testProcessFavoriteFilter() { + public function testProcessFavoriteFilter(): void { $rules = [ ['name' => '{http://owncloud.org/ns}favorite', 'value' => '1'], ]; @@ -730,7 +730,7 @@ class FilesReportPluginTest extends \Test\TestCase { /** * @dataProvider filesBaseUriProvider */ - public function testFilesBaseUri($uri, $reportPath, $expectedUri) { + public function testFilesBaseUri($uri, $reportPath, $expectedUri): void { $this->assertEquals($expectedUri, $this->invokePrivate($this->plugin, 'getFilesBaseUri', [$uri, $reportPath])); } } diff --git a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php index 3f38008559c..f646847396b 100644 --- a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php @@ -53,7 +53,7 @@ class MaintenancePluginTest extends TestCase { } - public function testMaintenanceMode() { + public function testMaintenanceMode(): void { $this->expectException(\Sabre\DAV\Exception\ServiceUnavailable::class); $this->expectExceptionMessage('System is in maintenance mode.'); diff --git a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php index 3ac5b8f841a..751e4c138b2 100644 --- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php @@ -63,7 +63,7 @@ class NodeTest extends \Test\TestCase { /** * @dataProvider davPermissionsProvider */ - public function testDavPermissions($permissions, $type, $shared, $mounted, $expected) { + public function testDavPermissions($permissions, $type, $shared, $mounted, $expected): void { $info = $this->getMockBuilder(FileInfo::class) ->disableOriginalConstructor() ->setMethods(['getPermissions', 'isShared', 'isMounted', 'getType']) @@ -131,7 +131,7 @@ class NodeTest extends \Test\TestCase { /** * @dataProvider sharePermissionsProvider */ - public function testSharePermissions($type, $user, $permissions, $expected) { + public function testSharePermissions($type, $user, $permissions, $expected): void { $storage = $this->getMockBuilder(Storage::class) ->disableOriginalConstructor() ->getMock(); @@ -172,7 +172,7 @@ class NodeTest extends \Test\TestCase { $this->assertEquals($expected, $node->getSharePermissions($user)); } - public function testShareAttributes() { + public function testShareAttributes(): void { $storage = $this->getMockBuilder(SharedStorage::class) ->disableOriginalConstructor() ->setMethods(['getShare']) @@ -207,7 +207,7 @@ class NodeTest extends \Test\TestCase { $this->assertEquals($attributes->toArray(), $node->getShareAttributes()); } - public function testShareAttributesNonShare() { + public function testShareAttributesNonShare(): void { $storage = $this->getMockBuilder(Storage::class) ->disableOriginalConstructor() ->getMock(); @@ -241,7 +241,7 @@ class NodeTest extends \Test\TestCase { /** * @dataProvider sanitizeMtimeProvider */ - public function testSanitizeMtime($mtime, $expected) { + public function testSanitizeMtime($mtime, $expected): void { $view = $this->getMockBuilder(View::class) ->disableOriginalConstructor() ->getMock(); @@ -263,7 +263,7 @@ class NodeTest extends \Test\TestCase { /** * @dataProvider invalidSanitizeMtimeProvider */ - public function testInvalidSanitizeMtime($mtime) { + public function testInvalidSanitizeMtime($mtime): void { $this->expectException(\InvalidArgumentException::class); $view = $this->getMockBuilder(View::class) diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php index 5f516cec113..d219888ef15 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php @@ -58,7 +58,7 @@ class ObjectTreeTest extends \Test\TestCase { /** * @dataProvider copyDataProvider */ - public function testCopy($sourcePath, $targetPath, $targetParent) { + public function testCopy($sourcePath, $targetPath, $targetParent): void { $view = $this->createMock(View::class); $view->expects($this->once()) ->method('verifyPath') @@ -103,7 +103,7 @@ class ObjectTreeTest extends \Test\TestCase { /** * @dataProvider copyDataProvider */ - public function testCopyFailNotCreatable($sourcePath, $targetPath, $targetParent) { + public function testCopyFailNotCreatable($sourcePath, $targetPath, $targetParent): void { $this->expectException(\Sabre\DAV\Exception\Forbidden::class); $view = $this->createMock(View::class); @@ -150,7 +150,7 @@ class ObjectTreeTest extends \Test\TestCase { $outputFileName, $type, $enableChunkingHeader - ) { + ): void { if ($enableChunkingHeader) { $_SERVER['HTTP_OC_CHUNKED'] = true; } @@ -265,7 +265,7 @@ class ObjectTreeTest extends \Test\TestCase { } - public function testGetNodeForPathInvalidPath() { + public function testGetNodeForPathInvalidPath(): void { $this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class); $path = '/foo\bar'; @@ -293,7 +293,7 @@ class ObjectTreeTest extends \Test\TestCase { $tree->getNodeForPath($path); } - public function testGetNodeForPathRoot() { + public function testGetNodeForPathRoot(): void { $path = '/'; diff --git a/apps/dav/tests/unit/Connector/Sabre/PropfindCompressionPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/PropfindCompressionPluginTest.php index e048190e633..ba97bba913a 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PropfindCompressionPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PropfindCompressionPluginTest.php @@ -40,7 +40,7 @@ class PropfindCompressionPluginTest extends TestCase { $this->plugin = new PropfindCompressionPlugin(); } - public function testNoHeader() { + public function testNoHeader(): void { $request = $this->createMock(Request::class); $response = $this->createMock(Response::class); @@ -55,7 +55,7 @@ class PropfindCompressionPluginTest extends TestCase { $this->assertSame($response, $result); } - public function testHeaderButNoGzip() { + public function testHeaderButNoGzip(): void { $request = $this->createMock(Request::class); $response = $this->createMock(Response::class); @@ -70,7 +70,7 @@ class PropfindCompressionPluginTest extends TestCase { $this->assertSame($response, $result); } - public function testHeaderGzipButNoStringBody() { + public function testHeaderGzipButNoStringBody(): void { $request = $this->createMock(Request::class); $response = $this->createMock(Response::class); @@ -86,7 +86,7 @@ class PropfindCompressionPluginTest extends TestCase { } - public function testProperGzip() { + public function testProperGzip(): void { $request = $this->createMock(Request::class); $response = $this->createMock(Response::class); diff --git a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php index 69b2140e640..4a9ca159bbd 100644 --- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php @@ -49,7 +49,7 @@ class QuotaPluginTest extends TestCase { /** @var \OCA\DAV\Connector\Sabre\QuotaPlugin | \PHPUnit\Framework\MockObject\MockObject */ private $plugin; - private function init($quota, $checkedPath = '') { + private function init($quota, $checkedPath = ''): void { $view = $this->buildFileViewMock($quota, $checkedPath); $this->server = new \Sabre\DAV\Server(); $this->plugin = $this->getMockBuilder(QuotaPlugin::class) @@ -62,7 +62,7 @@ class QuotaPluginTest extends TestCase { /** * @dataProvider lengthProvider */ - public function testLength($expected, $headers) { + public function testLength($expected, $headers): void { $this->init(0); $this->plugin->expects($this->never()) ->method('getFileChunking'); @@ -74,7 +74,7 @@ class QuotaPluginTest extends TestCase { /** * @dataProvider quotaOkayProvider */ - public function testCheckQuota($quota, $headers) { + public function testCheckQuota($quota, $headers): void { $this->init($quota); $this->plugin->expects($this->never()) ->method('getFileChunking'); @@ -87,7 +87,7 @@ class QuotaPluginTest extends TestCase { /** * @dataProvider quotaExceededProvider */ - public function testCheckExceededQuota($quota, $headers) { + public function testCheckExceededQuota($quota, $headers): void { $this->expectException(\Sabre\DAV\Exception\InsufficientStorage::class); $this->init($quota); @@ -101,7 +101,7 @@ class QuotaPluginTest extends TestCase { /** * @dataProvider quotaOkayProvider */ - public function testCheckQuotaOnPath($quota, $headers) { + public function testCheckQuotaOnPath($quota, $headers): void { $this->init($quota, 'sub/test.txt'); $this->plugin->expects($this->never()) ->method('getFileChunking'); @@ -176,7 +176,7 @@ class QuotaPluginTest extends TestCase { /** * @dataProvider quotaChunkedOkProvider */ - public function testCheckQuotaChunkedOk($quota, $chunkTotalSize, $headers) { + public function testCheckQuotaChunkedOk($quota, $chunkTotalSize, $headers): void { $this->init($quota, 'sub/test.txt'); $mockChunking = $this->getMockBuilder(\OC_FileChunking::class) @@ -211,7 +211,7 @@ class QuotaPluginTest extends TestCase { /** * @dataProvider quotaChunkedFailProvider */ - public function testCheckQuotaChunkedFail($quota, $chunkTotalSize, $headers) { + public function testCheckQuotaChunkedFail($quota, $chunkTotalSize, $headers): void { $this->expectException(\Sabre\DAV\Exception\InsufficientStorage::class); $this->init($quota, 'sub/test.txt'); diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php index 917c63038cb..d49008e00df 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/Auth.php @@ -113,7 +113,7 @@ class Auth implements BackendInterface { * @param ResponseInterface $response * @return void */ - public function challenge(RequestInterface $request, ResponseInterface $response) { + public function challenge(RequestInterface $request, ResponseInterface $response): void { // TODO: Implement challenge() method. } } diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php index b76564e59d4..02588715dcd 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php @@ -32,7 +32,7 @@ use OCP\AppFramework\Http; * @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest */ class DeleteTest extends RequestTestCase { - public function testBasicUpload() { + public function testBasicUpload(): void { $user = $this->getUniqueID(); $view = $this->setupUser($user, 'pass'); diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/DownloadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DownloadTest.php index ceae6fadf28..20747c4cfdc 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/DownloadTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DownloadTest.php @@ -35,7 +35,7 @@ use OCP\Lock\ILockingProvider; * @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest */ class DownloadTest extends RequestTestCase { - public function testDownload() { + public function testDownload(): void { $user = $this->getUniqueID(); $view = $this->setupUser($user, 'pass'); @@ -46,7 +46,7 @@ class DownloadTest extends RequestTestCase { $this->assertEquals(stream_get_contents($response->getBody()), 'bar'); } - public function testDownloadWriteLocked() { + public function testDownloadWriteLocked(): void { $user = $this->getUniqueID(); $view = $this->setupUser($user, 'pass'); @@ -58,7 +58,7 @@ class DownloadTest extends RequestTestCase { $this->assertEquals(Http::STATUS_LOCKED, $result->getStatus()); } - public function testDownloadReadLocked() { + public function testDownloadReadLocked(): void { $user = $this->getUniqueID(); $view = $this->setupUser($user, 'pass'); diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php index eb459912bf4..de7e19014f5 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php @@ -29,7 +29,7 @@ class ExceptionPlugin extends \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin { */ protected $exceptions = []; - public function logException(\Throwable $ex) { + public function logException(\Throwable $ex): void { $exceptionClass = get_class($ex); if (!isset($this->nonFatalExceptions[$exceptionClass])) { $this->exceptions[] = $ex; diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/Sapi.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/Sapi.php index 4a2e025f018..c339001b0e1 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/Sapi.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/Sapi.php @@ -55,7 +55,7 @@ class Sapi { * @param \Sabre\HTTP\Response $response * @return void */ - public function sendResponse(Response $response) { + public function sendResponse(Response $response): void { // we need to copy the body since we close the source stream $copyStream = fopen('php://temp', 'r+'); if (is_string($response->getBody())) { diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/UploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/UploadTest.php index 9f7d381ad14..16953d9b598 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/UploadTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/UploadTest.php @@ -35,7 +35,7 @@ use OCP\Lock\ILockingProvider; * @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest */ class UploadTest extends RequestTestCase { - public function testBasicUpload() { + public function testBasicUpload(): void { $user = $this->getUniqueID(); $view = $this->setupUser($user, 'pass'); @@ -51,7 +51,7 @@ class UploadTest extends RequestTestCase { $this->assertEquals(3, $info->getSize()); } - public function testUploadOverWrite() { + public function testUploadOverWrite(): void { $user = $this->getUniqueID(); $view = $this->setupUser($user, 'pass'); @@ -67,7 +67,7 @@ class UploadTest extends RequestTestCase { $this->assertEquals(3, $info->getSize()); } - public function testUploadOverWriteReadLocked() { + public function testUploadOverWriteReadLocked(): void { $user = $this->getUniqueID(); $view = $this->setupUser($user, 'pass'); @@ -79,7 +79,7 @@ class UploadTest extends RequestTestCase { $this->assertEquals(Http::STATUS_LOCKED, $result->getStatus()); } - public function testUploadOverWriteWriteLocked() { + public function testUploadOverWriteWriteLocked(): void { $user = $this->getUniqueID(); $view = $this->setupUser($user, 'pass'); $this->loginAsUser($user); @@ -92,7 +92,7 @@ class UploadTest extends RequestTestCase { $this->assertEquals(Http::STATUS_LOCKED, $result->getStatus()); } - public function testChunkedUpload() { + public function testChunkedUpload(): void { $user = $this->getUniqueID(); $view = $this->setupUser($user, 'pass'); @@ -114,7 +114,7 @@ class UploadTest extends RequestTestCase { $this->assertEquals(6, $info->getSize()); } - public function testChunkedUploadOverWrite() { + public function testChunkedUploadOverWrite(): void { $user = $this->getUniqueID(); $view = $this->setupUser($user, 'pass'); @@ -135,7 +135,7 @@ class UploadTest extends RequestTestCase { $this->assertEquals(6, $info->getSize()); } - public function testChunkedUploadOutOfOrder() { + public function testChunkedUploadOutOfOrder(): void { $user = $this->getUniqueID(); $view = $this->setupUser($user, 'pass'); @@ -157,7 +157,7 @@ class UploadTest extends RequestTestCase { $this->assertEquals(6, $info->getSize()); } - public function testChunkedUploadOutOfOrderReadLocked() { + public function testChunkedUploadOutOfOrderReadLocked(): void { $user = $this->getUniqueID(); $view = $this->setupUser($user, 'pass'); @@ -180,7 +180,7 @@ class UploadTest extends RequestTestCase { $this->assertEquals(Http::STATUS_LOCKED, $result->getStatus()); } - public function testChunkedUploadOutOfOrderWriteLocked() { + public function testChunkedUploadOutOfOrderWriteLocked(): void { $user = $this->getUniqueID(); $view = $this->setupUser($user, 'pass'); diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php index a81226ccb5e..abbf13d5479 100644 --- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php @@ -95,7 +95,7 @@ class SharesPluginTest extends \Test\TestCase { /** * @dataProvider sharesGetPropertiesDataProvider */ - public function testGetProperties($shareTypes) { + public function testGetProperties($shareTypes): void { $sabreNode = $this->getMockBuilder(Node::class) ->disableOriginalConstructor() ->getMock(); @@ -154,7 +154,7 @@ class SharesPluginTest extends \Test\TestCase { /** * @dataProvider sharesGetPropertiesDataProvider */ - public function testPreloadThenGetProperties($shareTypes) { + public function testPreloadThenGetProperties($shareTypes): void { $sabreNode1 = $this->createMock(File::class); $sabreNode1->method('getId') ->willReturn(111); diff --git a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php index ad49f45f6b0..05cd9d5978c 100644 --- a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php @@ -96,7 +96,7 @@ class TagsPluginTest extends \Test\TestCase { /** * @dataProvider tagsGetPropertiesDataProvider */ - public function testGetProperties($tags, $requestedProperties, $expectedProperties) { + public function testGetProperties($tags, $requestedProperties, $expectedProperties): void { $node = $this->getMockBuilder(Node::class) ->disableOriginalConstructor() ->getMock(); @@ -135,7 +135,7 @@ class TagsPluginTest extends \Test\TestCase { /** * @dataProvider tagsGetPropertiesDataProvider */ - public function testPreloadThenGetProperties($tags, $requestedProperties, $expectedProperties) { + public function testPreloadThenGetProperties($tags, $requestedProperties, $expectedProperties): void { $node1 = $this->getMockBuilder(File::class) ->disableOriginalConstructor() ->getMock(); @@ -289,7 +289,7 @@ class TagsPluginTest extends \Test\TestCase { $this->assertCount(2, $result[404]); } - public function testUpdateTags() { + public function testUpdateTags(): void { // this test will replace the existing tags "tagremove" with "tag1" and "tag2" // and keep "tagkeep" $node = $this->getMockBuilder(Node::class) @@ -342,7 +342,7 @@ class TagsPluginTest extends \Test\TestCase { $this->assertFalse(isset($result[self::FAVORITE_PROPERTYNAME])); } - public function testUpdateTagsFromScratch() { + public function testUpdateTagsFromScratch(): void { $node = $this->getMockBuilder(Node::class) ->disableOriginalConstructor() ->getMock(); @@ -388,7 +388,7 @@ class TagsPluginTest extends \Test\TestCase { $this->assertFalse(false, isset($result[self::FAVORITE_PROPERTYNAME])); } - public function testUpdateFav() { + public function testUpdateFav(): void { // this test will replace the existing tags "tagremove" with "tag1" and "tag2" // and keep "tagkeep" $node = $this->getMockBuilder(Node::class) |