diff options
author | provokateurin <kate@provokateurin.de> | 2024-09-26 09:22:26 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-09-26 09:22:26 +0200 |
commit | b9115da4f27ff2cc013da4ec88754c1175dd5216 (patch) | |
tree | cffbf11e3742d744f46ef95577d0b05c208e19eb /apps/dav/tests | |
parent | 9a220989dd1cd3a5792b8fc385ee1d7b1bcc7fb8 (diff) | |
download | nextcloud-server-refactor/apps/php55-features.tar.gz nextcloud-server-refactor/apps/php55-features.zip |
refactor(apps): Use PHP 5.5 featuresrefactor/apps/php55-features
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'apps/dav/tests')
29 files changed, 77 insertions, 77 deletions
diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php index 4333754222b..20473616761 100644 --- a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php +++ b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php @@ -52,7 +52,7 @@ class PublicCalendarRootTest extends TestCase { parent::setUp(); $db = \OC::$server->getDatabaseConnection(); - $this->principal = $this->createMock('OCA\DAV\Connector\Sabre\Principal'); + $this->principal = $this->createMock(\OCA\DAV\Connector\Sabre\Principal::class); $this->userManager = $this->createMock(IUserManager::class); $this->groupManager = $this->createMock(IGroupManager::class); $this->random = \OC::$server->getSecureRandom(); diff --git a/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php b/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php index cbfd4639ed7..0a93fb7a4c8 100644 --- a/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php +++ b/apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php @@ -12,7 +12,7 @@ use Test\TestCase; class CalendarSearchReportTest extends TestCase { private $elementMap = [ '{http://nextcloud.com/ns}calendar-search' => - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport', + \OCA\DAV\CalDAV\Search\Xml\Request\CalendarSearchReport::class, ]; public function testFoo(): void { diff --git a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php index ae4519e2542..4c7d7faaf93 100644 --- a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php @@ -51,7 +51,7 @@ class SearchPluginTest extends TestCase { $this->assertEquals( $server->xml->elementMap['{http://nextcloud.com/ns}calendar-search'], - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport' + \OCA\DAV\CalDAV\Search\Xml\Request\CalendarSearchReport::class ); } diff --git a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php index aeee04fd6ee..ec909a5e526 100644 --- a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php +++ b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php @@ -73,7 +73,7 @@ class BirthdayServiceTest extends TestCase { if ($expectedSummary === null) { $this->assertNull($cal); } else { - $this->assertInstanceOf('Sabre\VObject\Component\VCalendar', $cal); + $this->assertInstanceOf(\Sabre\VObject\Component\VCalendar::class, $cal); $this->assertEquals('-//IDN nextcloud.com//Birthday calendar//EN', $cal->PRODID->getValue()); $this->assertTrue(isset($cal->VEVENT)); $this->assertEquals($expectedRrule, $cal->VEVENT->RRULE->getValue()); diff --git a/apps/dav/tests/unit/CardDAV/ConverterTest.php b/apps/dav/tests/unit/CardDAV/ConverterTest.php index c29e0db5070..095e63f0aff 100644 --- a/apps/dav/tests/unit/CardDAV/ConverterTest.php +++ b/apps/dav/tests/unit/CardDAV/ConverterTest.php @@ -95,7 +95,7 @@ class ConverterTest extends TestCase { $converter = new Converter($accountManager, $this->userManager, $this->urlGenerator, $this->logger); $vCard = $converter->createCardFromUser($user); if ($expectedVCard !== null) { - $this->assertInstanceOf('Sabre\VObject\Component\VCard', $vCard); + $this->assertInstanceOf(\Sabre\VObject\Component\VCard::class, $vCard); $cardData = $vCard->jsonSerialize(); $this->compareData($expectedVCard, $cardData); } else { diff --git a/apps/dav/tests/unit/Comments/CommentsPluginTest.php b/apps/dav/tests/unit/Comments/CommentsPluginTest.php index 5ca0cedf04b..402c95a6aa3 100644 --- a/apps/dav/tests/unit/Comments/CommentsPluginTest.php +++ b/apps/dav/tests/unit/Comments/CommentsPluginTest.php @@ -41,7 +41,7 @@ class CommentsPluginTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); - $this->server = $this->getMockBuilder('\Sabre\DAV\Server') + $this->server = $this->getMockBuilder(\Sabre\DAV\Server::class) ->setConstructorArgs([$this->tree]) ->setMethods(['getRequestUri']) ->getMock(); diff --git a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php index c44f52ec713..f1b2a7acd28 100644 --- a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php @@ -65,7 +65,7 @@ class BlockLegacyClientPluginTest extends TestCase { $this->expectExceptionMessage('This version of the client is unsupported. Upgrade to <a href="https://nextcloud.com/install/#install-clients">version 1.7.0 or later</a>.'); /** @var RequestInterface|MockObject $request */ - $request = $this->createMock('\Sabre\HTTP\RequestInterface'); + $request = $this->createMock(\Sabre\HTTP\RequestInterface::class); $request ->expects($this->once()) ->method('getHeader') @@ -97,7 +97,7 @@ class BlockLegacyClientPluginTest extends TestCase { $this->expectExceptionMessage('This version of the client is unsupported. Upgrade to <a href="https://example.com"><script>alter("hacked");</script>">version 1.7.0 <script>alert("unsafe")</script> or later</a>.'); /** @var RequestInterface|MockObject $request */ - $request = $this->createMock('\Sabre\HTTP\RequestInterface'); + $request = $this->createMock(\Sabre\HTTP\RequestInterface::class); $request ->expects($this->once()) ->method('getHeader') diff --git a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php index 1cda0e4dbdb..5454926e532 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php @@ -32,7 +32,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); - $this->server = $this->getMockBuilder('\Sabre\DAV\Server') + $this->server = $this->getMockBuilder(\Sabre\DAV\Server::class) ->disableOriginalConstructor() ->getMock(); @@ -42,7 +42,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase { public function nodeProvider() { $mocks = []; - foreach (['\OCA\DAV\Connector\Sabre\File', '\OCA\DAV\Connector\Sabre\Directory', '\Sabre\DAV\INode'] as $class) { + foreach ([\OCA\DAV\Connector\Sabre\File::class, \OCA\DAV\Connector\Sabre\Directory::class, \Sabre\DAV\INode::class] as $class) { $mocks[] = $this->getMockBuilder($class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php index fb180b7c65d..aa3c8b9ba68 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php @@ -65,7 +65,7 @@ class DirectoryTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->view = $this->createMock('OC\Files\View'); + $this->view = $this->createMock(\OC\Files\View::class); $this->info = $this->createMock('OC\Files\FileInfo'); $this->info->method('isReadable') ->willReturn(true); @@ -283,8 +283,8 @@ class DirectoryTest extends \Test\TestCase { $storage->expects($this->any()) ->method('instanceOfStorage') ->willReturnMap([ - '\OCA\Files_Sharing\SharedStorage' => false, - '\OC\Files\Storage\Wrapper\Quota' => false, + \OCA\Files_Sharing\SharedStorage::class => false, + \OC\Files\Storage\Wrapper\Quota::class => false, ]); $storage->expects($this->once()) @@ -334,8 +334,8 @@ class DirectoryTest extends \Test\TestCase { $storage->expects($this->any()) ->method('instanceOfStorage') ->willReturnMap([ - ['\OCA\Files_Sharing\SharedStorage', false], - ['\OC\Files\Storage\Wrapper\Quota', true], + [\OCA\Files_Sharing\SharedStorage::class, false], + [\OC\Files\Storage\Wrapper\Quota::class, true], ]); $storage->expects($this->once()) diff --git a/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php b/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php index c7fb6066ed4..ab3fd2dd8d1 100644 --- a/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/Exception/ForbiddenTest.php @@ -32,7 +32,7 @@ class ForbiddenTest extends \Test\TestCase { EOD; $ex = new Forbidden($message, $retry); - $server = $this->getMockBuilder('Sabre\DAV\Server') + $server = $this->getMockBuilder(\Sabre\DAV\Server::class) ->disableOriginalConstructor() ->getMock(); $ex->serialize($server, $error); diff --git a/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php b/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php index 98921d735fa..1139cceb912 100644 --- a/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/Exception/InvalidPathTest.php @@ -32,7 +32,7 @@ class InvalidPathTest extends \Test\TestCase { EOD; $ex = new InvalidPath($message, $retry); - $server = $this->getMockBuilder('Sabre\DAV\Server') + $server = $this->getMockBuilder(\Sabre\DAV\Server::class) ->disableOriginalConstructor() ->getMock(); $ex->serialize($server, $error); diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php index 55a6783225d..f4f54e2f3cc 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -94,53 +94,53 @@ class FileTest extends TestCase { [ // return false null, - '\Sabre\Dav\Exception', + \Sabre\Dav\Exception::class, false ], [ new \OCP\Files\NotPermittedException(), - 'Sabre\DAV\Exception\Forbidden' + \Sabre\DAV\Exception\Forbidden::class ], [ new \OCP\Files\EntityTooLargeException(), - 'OCA\DAV\Connector\Sabre\Exception\EntityTooLarge' + \OCA\DAV\Connector\Sabre\Exception\EntityTooLarge::class ], [ new \OCP\Files\InvalidContentException(), - 'OCA\DAV\Connector\Sabre\Exception\UnsupportedMediaType' + \OCA\DAV\Connector\Sabre\Exception\UnsupportedMediaType::class ], [ new \OCP\Files\InvalidPathException(), - 'Sabre\DAV\Exception\Forbidden' + \Sabre\DAV\Exception\Forbidden::class ], [ new \OCP\Files\ForbiddenException('', true), - 'OCA\DAV\Connector\Sabre\Exception\Forbidden' + \OCA\DAV\Connector\Sabre\Exception\Forbidden::class ], [ new \OCP\Files\LockNotAcquiredException('/test.txt', 1), - 'OCA\DAV\Connector\Sabre\Exception\FileLocked' + \OCA\DAV\Connector\Sabre\Exception\FileLocked::class ], [ new \OCP\Lock\LockedException('/test.txt'), - 'OCA\DAV\Connector\Sabre\Exception\FileLocked' + \OCA\DAV\Connector\Sabre\Exception\FileLocked::class ], [ new \OCP\Encryption\Exceptions\GenericEncryptionException(), - 'Sabre\DAV\Exception\ServiceUnavailable' + \Sabre\DAV\Exception\ServiceUnavailable::class ], [ new \OCP\Files\StorageNotAvailableException(), - 'Sabre\DAV\Exception\ServiceUnavailable' + \Sabre\DAV\Exception\ServiceUnavailable::class ], [ new \Sabre\DAV\Exception('Generic sabre exception'), - 'Sabre\DAV\Exception', + \Sabre\DAV\Exception::class, false ], [ new \Exception('Generic exception'), - 'Sabre\DAV\Exception' + \Sabre\DAV\Exception::class ], ]; } diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php index 9d8f4e8d4c4..74d36a06f1f 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php @@ -124,7 +124,7 @@ class FilesPluginTest extends TestCase { public function testGetPropertiesForFile(): void { /** @var \OCA\DAV\Connector\Sabre\File | \PHPUnit\Framework\MockObject\MockObject $node */ - $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); + $node = $this->createTestNode(\OCA\DAV\Connector\Sabre\File::class); $propFind = new PropFind( '/dummyPath', @@ -181,7 +181,7 @@ class FilesPluginTest extends TestCase { public function testGetPropertiesStorageNotAvailable(): void { /** @var \OCA\DAV\Connector\Sabre\File | \PHPUnit\Framework\MockObject\MockObject $node */ - $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); + $node = $this->createTestNode(\OCA\DAV\Connector\Sabre\File::class); $propFind = new PropFind( '/dummyPath', @@ -228,7 +228,7 @@ class FilesPluginTest extends TestCase { ); /** @var \OCA\DAV\Connector\Sabre\File | \PHPUnit\Framework\MockObject\MockObject $node */ - $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); + $node = $this->createTestNode(\OCA\DAV\Connector\Sabre\File::class); $node->expects($this->any()) ->method('getDavPermissions') ->willReturn('DWCKMSR'); @@ -243,7 +243,7 @@ class FilesPluginTest extends TestCase { public function testGetPropertiesForDirectory(): void { /** @var \OCA\DAV\Connector\Sabre\Directory | \PHPUnit\Framework\MockObject\MockObject $node */ - $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory'); + $node = $this->createTestNode(\OCA\DAV\Connector\Sabre\Directory::class); $propFind = new PropFind( '/dummyPath', @@ -345,7 +345,7 @@ class FilesPluginTest extends TestCase { } public function testUpdateProps(): void { - $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); + $node = $this->createTestNode(\OCA\DAV\Connector\Sabre\File::class); $testDate = 'Fri, 13 Feb 2015 00:01:02 GMT'; $testCreationDate = '2007-08-31T16:47+00:00'; @@ -615,7 +615,7 @@ class FilesPluginTest extends TestCase { public function testHasPreview(): void { /** @var \OCA\DAV\Connector\Sabre\Directory | \PHPUnit\Framework\MockObject\MockObject $node */ - $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory'); + $node = $this->createTestNode(\OCA\DAV\Connector\Sabre\Directory::class); $propFind = new PropFind( '/dummyPath', diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php index 76a70a93e13..cbc06ae782a 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php @@ -58,7 +58,7 @@ class FilesReportPluginTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); - $this->server = $this->getMockBuilder('\Sabre\DAV\Server') + $this->server = $this->getMockBuilder(\Sabre\DAV\Server::class) ->setConstructorArgs([$this->tree]) ->onlyMethods(['getRequestUri', 'getBaseUri']) ->getMock(); @@ -293,9 +293,9 @@ class FilesReportPluginTest extends \Test\TestCase { $result = $this->plugin->findNodesByFileIds($reportTargetNode, ['111', '222']); $this->assertCount(2, $result); - $this->assertInstanceOf('\OCA\DAV\Connector\Sabre\Directory', $result[0]); + $this->assertInstanceOf(\OCA\DAV\Connector\Sabre\Directory::class, $result[0]); $this->assertEquals('first node', $result[0]->getName()); - $this->assertInstanceOf('\OCA\DAV\Connector\Sabre\File', $result[1]); + $this->assertInstanceOf(\OCA\DAV\Connector\Sabre\File::class, $result[1]); $this->assertEquals('second node', $result[1]->getName()); } @@ -346,9 +346,9 @@ class FilesReportPluginTest extends \Test\TestCase { $result = $this->plugin->findNodesByFileIds($reportTargetNode, ['111', '222']); $this->assertCount(2, $result); - $this->assertInstanceOf('\OCA\DAV\Connector\Sabre\Directory', $result[0]); + $this->assertInstanceOf(\OCA\DAV\Connector\Sabre\Directory::class, $result[0]); $this->assertEquals('first node', $result[0]->getName()); - $this->assertInstanceOf('\OCA\DAV\Connector\Sabre\File', $result[1]); + $this->assertInstanceOf(\OCA\DAV\Connector\Sabre\File::class, $result[1]); $this->assertEquals('second node', $result[1]->getName()); } @@ -410,14 +410,14 @@ class FilesReportPluginTest extends \Test\TestCase { $props1 = $responses[0]->getResponseProperties(); $this->assertEquals('111', $props1[200]['{http://owncloud.org/ns}fileid']); $this->assertNull($props1[404]['{DAV:}getcontentlength']); - $this->assertInstanceOf('\Sabre\DAV\Xml\Property\ResourceType', $props1[200]['{DAV:}resourcetype']); + $this->assertInstanceOf(\Sabre\DAV\Xml\Property\ResourceType::class, $props1[200]['{DAV:}resourcetype']); $resourceType1 = $props1[200]['{DAV:}resourcetype']->getValue(); $this->assertEquals('{DAV:}collection', $resourceType1[0]); $props2 = $responses[1]->getResponseProperties(); $this->assertEquals('1024', $props2[200]['{DAV:}getcontentlength']); $this->assertEquals('222', $props2[200]['{http://owncloud.org/ns}fileid']); - $this->assertInstanceOf('\Sabre\DAV\Xml\Property\ResourceType', $props2[200]['{DAV:}resourcetype']); + $this->assertInstanceOf(\Sabre\DAV\Xml\Property\ResourceType::class, $props2[200]['{DAV:}resourcetype']); $this->assertCount(0, $props2[200]['{DAV:}resourcetype']->getValue()); } diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php index 4f2e5174325..215098ff56a 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php @@ -252,6 +252,6 @@ class ObjectTreeTest extends \Test\TestCase { $tree = new \OCA\DAV\Connector\Sabre\ObjectTree(); $tree->init($rootNode, $view, $mountManager); - $this->assertInstanceOf('\Sabre\DAV\INode', $tree->getNodeForPath($path)); + $this->assertInstanceOf(\Sabre\DAV\INode::class, $tree->getNodeForPath($path)); } } diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php index e7f20fbadfa..24a017b3a8b 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/DeleteTest.php @@ -29,7 +29,7 @@ class DeleteTest extends RequestTestCase { $mount->getStorage()->unlink($mount->getInternalPath($internalPath)); // cache entry still exists - $this->assertInstanceOf('\OCP\Files\FileInfo', $view->getFileInfo('foo.txt')); + $this->assertInstanceOf(\OCP\Files\FileInfo::class, $view->getFileInfo('foo.txt')); $response = $this->request($view, $user, 'pass', 'DELETE', '/foo.txt'); diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php index cbaa0c3101b..575e37652ba 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php @@ -23,7 +23,7 @@ class EncryptionMasterKeyUploadTest extends UploadTest { protected function setupUser($name, $password) { $this->createUser($name, $password); $tmpFolder = \OC::$server->getTempManager()->getTemporaryFolder(); - $this->registerMount($name, '\OC\Files\Storage\Local', '/' . $name, ['datadir' => $tmpFolder]); + $this->registerMount($name, \OC\Files\Storage\Local::class, '/' . $name, ['datadir' => $tmpFolder]); // we use the master key \OC::$server->getConfig()->setAppValue('encryption', 'useMasterKey', '1'); $this->setupForUser($name, $password); diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php index f830c54fd0d..86242c32e78 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php @@ -23,7 +23,7 @@ class EncryptionUploadTest extends UploadTest { protected function setupUser($name, $password) { $this->createUser($name, $password); $tmpFolder = \OC::$server->getTempManager()->getTemporaryFolder(); - $this->registerMount($name, '\OC\Files\Storage\Local', '/' . $name, ['datadir' => $tmpFolder]); + $this->registerMount($name, \OC\Files\Storage\Local::class, '/' . $name, ['datadir' => $tmpFolder]); // we use per-user keys \OC::$server->getConfig()->setAppValue('encryption', 'useMasterKey', '0'); $this->setupForUser($name, $password); diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php index 29574d53bca..599e9a8e5ef 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php @@ -58,7 +58,7 @@ abstract class RequestTestCase extends TestCase { protected function setupUser($name, $password) { $this->createUser($name, $password); $tmpFolder = \OC::$server->getTempManager()->getTemporaryFolder(); - $this->registerMount($name, '\OC\Files\Storage\Local', '/' . $name, ['datadir' => $tmpFolder]); + $this->registerMount($name, \OC\Files\Storage\Local::class, '/' . $name, ['datadir' => $tmpFolder]); $this->loginAsUser($name); return new View('/' . $name . '/files'); } diff --git a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php index c7c2bf0e431..ad5d42cae59 100644 --- a/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php +++ b/apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php @@ -83,7 +83,7 @@ class BirthdayCalendarControllerTest extends TestCase { ); $response = $this->controller->enable(); - $this->assertInstanceOf('OCP\AppFramework\Http\JSONResponse', $response); + $this->assertInstanceOf(\OCP\AppFramework\Http\JSONResponse::class, $response); } public function testDisable(): void { @@ -97,6 +97,6 @@ class BirthdayCalendarControllerTest extends TestCase { ->method('deleteAllBirthdayCalendars'); $response = $this->controller->disable(); - $this->assertInstanceOf('OCP\AppFramework\Http\JSONResponse', $response); + $this->assertInstanceOf(\OCP\AppFramework\Http\JSONResponse::class, $response); } } diff --git a/apps/dav/tests/unit/DAV/ErrorPagePluginTest.php b/apps/dav/tests/unit/DAV/ErrorPagePluginTest.php index a3569f34bd7..7cd2436e8b5 100644 --- a/apps/dav/tests/unit/DAV/ErrorPagePluginTest.php +++ b/apps/dav/tests/unit/DAV/ErrorPagePluginTest.php @@ -24,7 +24,7 @@ class ErrorPagePluginTest extends \Test\TestCase { $plugin->expects($this->once())->method('generateBody')->willReturn(':boom:'); $plugin->expects($this->once())->method('sendResponse'); /** @var \Sabre\DAV\Server | \PHPUnit\Framework\MockObject\MockObject $server */ - $server = $this->getMockBuilder('Sabre\DAV\Server')->disableOriginalConstructor()->getMock(); + $server = $this->getMockBuilder(\Sabre\DAV\Server::class)->disableOriginalConstructor()->getMock(); $server->expects($this->once())->method('on'); $httpResponse = $this->getMockBuilder(Response::class)->disableOriginalConstructor()->getMock(); $httpResponse->expects($this->once())->method('addHeaders'); diff --git a/apps/dav/tests/unit/Files/MultipartRequestParserTest.php b/apps/dav/tests/unit/Files/MultipartRequestParserTest.php index e6325ab8ad1..808e3963946 100644 --- a/apps/dav/tests/unit/Files/MultipartRequestParserTest.php +++ b/apps/dav/tests/unit/Files/MultipartRequestParserTest.php @@ -32,7 +32,7 @@ class MultipartRequestParserTest extends TestCase { } private function getMultipartParser(array $parts, array $headers = [], string $boundary = 'boundary_azertyuiop'): MultipartRequestParser { - $request = $this->getMockBuilder('Sabre\HTTP\RequestInterface') + $request = $this->getMockBuilder(\Sabre\HTTP\RequestInterface::class) ->disableOriginalConstructor() ->getMock(); @@ -74,7 +74,7 @@ class MultipartRequestParserTest extends TestCase { */ public function testBodyTypeValidation(): void { $bodyStream = 'I am not a stream, but pretend to be'; - $request = $this->getMockBuilder('Sabre\HTTP\RequestInterface') + $request = $this->getMockBuilder(\Sabre\HTTP\RequestInterface::class) ->disableOriginalConstructor() ->getMock(); $request->expects($this->any()) diff --git a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php index 308950cef34..4e37cc056f6 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php @@ -97,12 +97,12 @@ class SystemTagMappingNodeTest extends \Test\TestCase { [ // cannot unassign invisible tag new SystemTag(1, 'Original', false, true), - 'Sabre\DAV\Exception\NotFound', + \Sabre\DAV\Exception\NotFound::class, ], [ // cannot unassign non-assignable tag new SystemTag(1, 'Original', true, false), - 'Sabre\DAV\Exception\Forbidden', + \Sabre\DAV\Exception\Forbidden::class, ], ]; } diff --git a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php index 82aa81674df..a5d9df1dbf7 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php @@ -117,37 +117,37 @@ class SystemTagNodeTest extends \Test\TestCase { // changing permissions not allowed new SystemTag(1, 'Original', true, true), ['Original', false, true], - 'Sabre\DAV\Exception\Forbidden', + \Sabre\DAV\Exception\Forbidden::class, ], [ // changing permissions not allowed new SystemTag(1, 'Original', true, true), ['Original', true, false], - 'Sabre\DAV\Exception\Forbidden', + \Sabre\DAV\Exception\Forbidden::class, ], [ // changing permissions not allowed new SystemTag(1, 'Original', true, true), ['Original', false, false], - 'Sabre\DAV\Exception\Forbidden', + \Sabre\DAV\Exception\Forbidden::class, ], [ // changing non-assignable not allowed new SystemTag(1, 'Original', true, false), ['Rename', true, false], - 'Sabre\DAV\Exception\Forbidden', + \Sabre\DAV\Exception\Forbidden::class, ], [ // changing non-assignable not allowed new SystemTag(1, 'Original', true, false), ['Original', true, true], - 'Sabre\DAV\Exception\Forbidden', + \Sabre\DAV\Exception\Forbidden::class, ], [ // invisible tag does not exist new SystemTag(1, 'Original', false, false), ['Rename', false, false], - 'Sabre\DAV\Exception\NotFound', + \Sabre\DAV\Exception\NotFound::class, ], ]; } @@ -242,12 +242,12 @@ class SystemTagNodeTest extends \Test\TestCase { [ // cannot delete invisible tag new SystemTag(1, 'Original', false, true), - 'Sabre\DAV\Exception\Forbidden', + \Sabre\DAV\Exception\Forbidden::class, ], [ // cannot delete non-assignable tag new SystemTag(1, 'Original', true, false), - 'Sabre\DAV\Exception\Forbidden', + \Sabre\DAV\Exception\Forbidden::class, ], ]; } diff --git a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php index 67e7afa9c54..db4feda0d40 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php @@ -575,8 +575,8 @@ class SystemTagPluginTest extends \Test\TestCase { public function nodeClassProvider() { return [ - ['\OCA\DAV\SystemTag\SystemTagsByIdCollection'], - ['\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection'], + [\OCA\DAV\SystemTag\SystemTagsByIdCollection::class], + [\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection::class], ]; } diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php index db55d82adc9..9629b1fcf70 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php @@ -89,7 +89,7 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase { $childNode = $this->getNode()->getChild('123'); - $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagNode', $childNode); + $this->assertInstanceOf(\OCA\DAV\SystemTag\SystemTagNode::class, $childNode); $this->assertEquals('123', $childNode->getName()); $this->assertEquals($tag, $childNode->getSystemTag()); } @@ -145,8 +145,8 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase { $this->assertCount(2, $children); - $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagNode', $children[0]); - $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagNode', $children[1]); + $this->assertInstanceOf(\OCA\DAV\SystemTag\SystemTagNode::class, $children[0]); + $this->assertInstanceOf(\OCA\DAV\SystemTag\SystemTagNode::class, $children[1]); $this->assertEquals($tag1, $children[0]->getSystemTag()); $this->assertEquals($tag2, $children[1]->getSystemTag()); } @@ -164,8 +164,8 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase { $this->assertCount(2, $children); - $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagNode', $children[0]); - $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagNode', $children[1]); + $this->assertInstanceOf(\OCA\DAV\SystemTag\SystemTagNode::class, $children[0]); + $this->assertInstanceOf(\OCA\DAV\SystemTag\SystemTagNode::class, $children[1]); $this->assertEquals($tag1, $children[0]->getSystemTag()); $this->assertEquals($tag2, $children[1]->getSystemTag()); } diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php index c2e62f73828..d7787d9dd82 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php @@ -88,9 +88,9 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase { public function permissionsProvider() { return [ // invisible, tag does not exist for user - [false, true, '\Sabre\DAV\Exception\PreconditionFailed'], + [false, true, \Sabre\DAV\Exception\PreconditionFailed::class], // visible but static, cannot assign tag - [true, false, '\Sabre\DAV\Exception\Forbidden'], + [true, false, \Sabre\DAV\Exception\Forbidden::class], ]; } @@ -163,7 +163,7 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase { $childNode = $this->getNode()->getChild('555'); - $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagMappingNode', $childNode); + $this->assertInstanceOf(\OCA\DAV\SystemTag\SystemTagMappingNode::class, $childNode); $this->assertEquals('555', $childNode->getName()); } @@ -251,8 +251,8 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase { $this->assertCount(2, $children); - $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagMappingNode', $children[0]); - $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagMappingNode', $children[1]); + $this->assertInstanceOf(\OCA\DAV\SystemTag\SystemTagMappingNode::class, $children[0]); + $this->assertInstanceOf(\OCA\DAV\SystemTag\SystemTagMappingNode::class, $children[1]); $this->assertEquals(111, $children[0]->getObjectId()); $this->assertEquals('files', $children[0]->getObjectType()); diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php index b202f340e32..d2868113efa 100644 --- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php +++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php @@ -111,7 +111,7 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase { ->willReturn($this->createMock(\OCP\Files\Node::class)); $childNode = $this->node->getChild('555'); - $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection', $childNode); + $this->assertInstanceOf(\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection::class, $childNode); $this->assertEquals('555', $childNode->getName()); } diff --git a/apps/dav/tests/unit/Upload/ChunkingPluginTest.php b/apps/dav/tests/unit/Upload/ChunkingPluginTest.php index 87feebf5d09..400fe5a6b69 100644 --- a/apps/dav/tests/unit/Upload/ChunkingPluginTest.php +++ b/apps/dav/tests/unit/Upload/ChunkingPluginTest.php @@ -38,10 +38,10 @@ class ChunkingPluginTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->server = $this->getMockBuilder('\Sabre\DAV\Server') + $this->server = $this->getMockBuilder(\Sabre\DAV\Server::class) ->disableOriginalConstructor() ->getMock(); - $this->tree = $this->getMockBuilder('\Sabre\DAV\Tree') + $this->tree = $this->getMockBuilder(\Sabre\DAV\Tree::class) ->disableOriginalConstructor() ->getMock(); |