diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-10-25 00:03:28 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-10-26 10:16:12 +0200 |
commit | ab36980d20feb895d9b33ff5dbaacc2cd9fbd3fc (patch) | |
tree | b5165a41d54f8d9e1fae58a69961a6d1c75fb6b4 /apps/dav/tests/unit/Connector | |
parent | a82b56b1c7146ddb3085f3e03e18be4700d95a0e (diff) | |
download | nextcloud-server-ab36980d20feb895d9b33ff5dbaacc2cd9fbd3fc.tar.gz nextcloud-server-ab36980d20feb895d9b33ff5dbaacc2cd9fbd3fc.zip |
Use ::class in test mocks of dav app
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/dav/tests/unit/Connector')
14 files changed, 77 insertions, 54 deletions
diff --git a/apps/dav/tests/unit/Connector/PublicAuthTest.php b/apps/dav/tests/unit/Connector/PublicAuthTest.php index 90401e03853..dbb39bac6d2 100644 --- a/apps/dav/tests/unit/Connector/PublicAuthTest.php +++ b/apps/dav/tests/unit/Connector/PublicAuthTest.php @@ -28,6 +28,7 @@ use OCP\IRequest; use OCP\ISession; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager; +use OCP\Share\IShare; /** * Class PublicAuthTest @@ -94,7 +95,7 @@ class PublicAuthTest extends \Test\TestCase { } public function testShareNoPassword() { - $share = $this->getMockBuilder('OCP\Share\IShare') + $share = $this->getMockBuilder(IShare::class) ->disableOriginalConstructor() ->getMock(); $share->method('getPassword')->willReturn(null); @@ -109,7 +110,7 @@ class PublicAuthTest extends \Test\TestCase { } public function testSharePasswordFancyShareType() { - $share = $this->getMockBuilder('OCP\Share\IShare') + $share = $this->getMockBuilder(IShare::class) ->disableOriginalConstructor() ->getMock(); $share->method('getPassword')->willReturn('password'); @@ -126,7 +127,7 @@ class PublicAuthTest extends \Test\TestCase { public function testSharePasswordRemote() { - $share = $this->getMockBuilder('OCP\Share\IShare') + $share = $this->getMockBuilder(IShare::class) ->disableOriginalConstructor() ->getMock(); $share->method('getPassword')->willReturn('password'); @@ -142,7 +143,7 @@ class PublicAuthTest extends \Test\TestCase { } public function testSharePasswordLinkValidPassword() { - $share = $this->getMockBuilder('OCP\Share\IShare') + $share = $this->getMockBuilder(IShare::class) ->disableOriginalConstructor() ->getMock(); $share->method('getPassword')->willReturn('password'); @@ -164,7 +165,7 @@ class PublicAuthTest extends \Test\TestCase { } public function testSharePasswordMailValidPassword() { - $share = $this->getMockBuilder('OCP\Share\IShare') + $share = $this->getMockBuilder(IShare::class) ->disableOriginalConstructor() ->getMock(); $share->method('getPassword')->willReturn('password'); @@ -186,7 +187,7 @@ class PublicAuthTest extends \Test\TestCase { } public function testSharePasswordLinkValidSession() { - $share = $this->getMockBuilder('OCP\Share\IShare') + $share = $this->getMockBuilder(IShare::class) ->disableOriginalConstructor() ->getMock(); $share->method('getPassword')->willReturn('password'); @@ -212,7 +213,7 @@ class PublicAuthTest extends \Test\TestCase { } public function testSharePasswordLinkInvalidSession() { - $share = $this->getMockBuilder('OCP\Share\IShare') + $share = $this->getMockBuilder(IShare::class) ->disableOriginalConstructor() ->getMock(); $share->method('getPassword')->willReturn('password'); @@ -239,7 +240,7 @@ class PublicAuthTest extends \Test\TestCase { public function testSharePasswordMailInvalidSession() { - $share = $this->getMockBuilder('OCP\Share\IShare') + $share = $this->getMockBuilder(IShare::class) ->disableOriginalConstructor() ->getMock(); $share->method('getPassword')->willReturn('password'); diff --git a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php index c02bd5046d8..c31a3af980b 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php @@ -29,6 +29,7 @@ use OCA\DAV\Connector\Sabre\File; use OCP\Comments\ICommentsManager; use OCP\IUser; use OCP\IUserSession; +use Sabre\DAV\PropFind; class CommentsPropertiesPluginTest extends \Test\TestCase { @@ -77,7 +78,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase { * @param $expectedSuccessful */ public function testHandleGetProperties($node, $expectedSuccessful) { - $propFind = $this->getMockBuilder('\Sabre\DAV\PropFind') + $propFind = $this->getMockBuilder(PropFind::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php index 773d5d7f98b..f44a4abf634 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php @@ -24,7 +24,9 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre; use OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin; +use OCA\DAV\Connector\Sabre\File; use Sabre\DAV\Server; +use Sabre\DAV\Tree; use Test\TestCase; /** @@ -68,13 +70,13 @@ class CopyEtagHeaderPluginTest extends TestCase { } public function testAfterMove() { - $node = $this->getMockBuilder('OCA\DAV\Connector\Sabre\File') + $node = $this->getMockBuilder(File::class) ->disableOriginalConstructor() ->getMock(); $node->expects($this->once()) ->method('getETag') ->willReturn('123456'); - $tree = $this->getMockBuilder('Sabre\DAV\Tree') + $tree = $this->getMockBuilder(Tree::class) ->disableOriginalConstructor() ->getMock(); $tree->expects($this->once()) diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php index f27f67b0aae..d5da0dce0d1 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php @@ -26,6 +26,7 @@ namespace OCA\DAV\Tests\Unit\Connector\Sabre; +use OC\Files\Storage\Wrapper\Quota; use OCP\Files\ForbiddenException; use OC\Files\FileInfo; use OCA\DAV\Connector\Sabre\Directory; @@ -179,10 +180,10 @@ class DirectoryTest extends \Test\TestCase { } public function testGetChildren() { - $info1 = $this->getMockBuilder('OC\Files\FileInfo') + $info1 = $this->getMockBuilder(FileInfo::class) ->disableOriginalConstructor() ->getMock(); - $info2 = $this->getMockBuilder('OC\Files\FileInfo') + $info2 = $this->getMockBuilder(FileInfo::class) ->disableOriginalConstructor() ->getMock(); $info1->expects($this->any()) @@ -269,7 +270,7 @@ class DirectoryTest extends \Test\TestCase { } public function testGetQuotaInfoUnlimited() { - $storage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Quota') + $storage = $this->getMockBuilder(Quota::class) ->disableOriginalConstructor() ->getMock(); @@ -300,7 +301,7 @@ class DirectoryTest extends \Test\TestCase { } public function testGetQuotaInfoSpecific() { - $storage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Quota') + $storage = $this->getMockBuilder(Quota::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php b/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php index f16c374a0e1..fa6f849f12f 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php @@ -27,6 +27,8 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre; use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin; use Sabre\DAV\Server; +use Sabre\HTTP\RequestInterface; +use Sabre\HTTP\ResponseInterface; use Test\TestCase; /** @@ -60,11 +62,11 @@ class DummyGetResponsePluginTest extends TestCase { public function testHttpGet() { /** @var \Sabre\HTTP\RequestInterface $request */ - $request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface') + $request = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() ->getMock(); /** @var \Sabre\HTTP\ResponseInterface $response */ - $response = $server = $this->getMockBuilder('\Sabre\HTTP\ResponseInterface') + $response = $server = $this->getMockBuilder(ResponseInterface::class) ->disableOriginalConstructor() ->getMock(); $response diff --git a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php index 1fd2b05c23d..e42bb1704f0 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php @@ -26,8 +26,11 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre; use OCA\DAV\Connector\Sabre\FakeLockerPlugin; use Sabre\DAV\INode; +use Sabre\DAV\PropFind; use Sabre\DAV\Server; +use Sabre\HTTP\RequestInterface; use Sabre\HTTP\Response; +use Sabre\HTTP\ResponseInterface; use Test\TestCase; /** @@ -85,7 +88,7 @@ class FakeLockerPluginTest extends TestCase { } public function testPropFind() { - $propFind = $this->getMockBuilder('\Sabre\DAV\PropFind') + $propFind = $this->getMockBuilder(PropFind::class) ->disableOriginalConstructor() ->getMock(); $node = $this->getMockBuilder(INode::class) @@ -145,7 +148,7 @@ class FakeLockerPluginTest extends TestCase { * @param array $expected */ public function testValidateTokens(array $input, array $expected) { - $request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface') + $request = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() ->getMock(); $this->fakeLockerPlugin->validateTokens($request, $input); @@ -153,7 +156,7 @@ class FakeLockerPluginTest extends TestCase { } public function testFakeLockProvider() { - $request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface') + $request = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() ->getMock(); $response = new Response(); @@ -173,10 +176,10 @@ class FakeLockerPluginTest extends TestCase { } public function testFakeUnlockProvider() { - $request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface') + $request = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() ->getMock(); - $response = $this->getMockBuilder('\Sabre\HTTP\ResponseInterface') + $response = $this->getMockBuilder(ResponseInterface::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php index 3a2075941ae..bf9daebdc5b 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -882,7 +882,7 @@ class FileTest extends \Test\TestCase { $wasLockedPre = false; $wasLockedPost = false; - $eventHandler = $this->getMockBuilder('\stdclass') + $eventHandler = $this->getMockBuilder(\stdclass::class) ->setMethods(['writeCallback', 'postWriteCallback']) ->getMock(); diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php index a33ece3c4b3..e3cf1ff4453 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php @@ -25,8 +25,10 @@ */ namespace OCA\DAV\Tests\unit\Connector\Sabre; +use OC\User\User; use OCA\DAV\Connector\Sabre\File; use OCA\DAV\Connector\Sabre\FilesPlugin; +use OCA\DAV\Connector\Sabre\Node; use OCP\Files\StorageNotAvailableException; use OCP\IConfig; use OCP\IPreview; @@ -188,7 +190,7 @@ class FilesPluginTest extends TestCase { 0 ); - $user = $this->getMockBuilder('\OC\User\User') + $user = $this->getMockBuilder(User::class) ->disableOriginalConstructor()->getMock(); $user ->expects($this->once()) @@ -457,14 +459,14 @@ class FilesPluginTest extends TestCase { * @expectedExceptionMessage FolderA/test.txt cannot be deleted */ public function testMoveSrcNotDeletable() { - $fileInfoFolderATestTXT = $this->getMockBuilder('\OCP\Files\FileInfo') + $fileInfoFolderATestTXT = $this->getMockBuilder(FileInfo::class) ->disableOriginalConstructor() ->getMock(); $fileInfoFolderATestTXT->expects($this->once()) ->method('isDeletable') ->willReturn(false); - $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') + $node = $this->getMockBuilder(Node::class) ->disableOriginalConstructor() ->getMock(); $node->expects($this->once()) @@ -478,14 +480,14 @@ class FilesPluginTest extends TestCase { } public function testMoveSrcDeletable() { - $fileInfoFolderATestTXT = $this->getMockBuilder('\OCP\Files\FileInfo') + $fileInfoFolderATestTXT = $this->getMockBuilder(FileInfo::class) ->disableOriginalConstructor() ->getMock(); $fileInfoFolderATestTXT->expects($this->once()) ->method('isDeletable') ->willReturn(true); - $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') + $node = $this->getMockBuilder(Node::class) ->disableOriginalConstructor() ->getMock(); $node->expects($this->once()) @@ -503,7 +505,7 @@ class FilesPluginTest extends TestCase { * @expectedExceptionMessage FolderA/test.txt does not exist */ public function testMoveSrcNotExist() { - $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') + $node = $this->getMockBuilder(Node::class) ->disableOriginalConstructor() ->getMock(); $node->expects($this->once()) diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php index 374557c6b67..c46e4b14805 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php @@ -33,6 +33,7 @@ use OCP\IRequest; use OCP\ITagManager; use OCP\IUser; use OCP\IUserSession; +use OCP\SystemTag\ISystemTag; use OCP\SystemTag\ISystemTagObjectMapper; use OC\Files\View; use OCP\Files\Folder; @@ -550,7 +551,7 @@ class FilesReportPluginTest extends \Test\TestCase { ->method('isAdmin') ->will($this->returnValue(true)); - $tag1 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag') + $tag1 = $this->getMockBuilder(ISystemTag::class) ->disableOriginalConstructor() ->getMock(); $tag1->expects($this->any()) @@ -560,7 +561,7 @@ class FilesReportPluginTest extends \Test\TestCase { ->method('isUserVisible') ->will($this->returnValue(true)); - $tag2 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag') + $tag2 = $this->getMockBuilder(ISystemTag::class) ->disableOriginalConstructor() ->getMock(); $tag2->expects($this->any()) @@ -599,7 +600,7 @@ class FilesReportPluginTest extends \Test\TestCase { ->method('isAdmin') ->will($this->returnValue(false)); - $tag1 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag') + $tag1 = $this->getMockBuilder(ISystemTag::class) ->disableOriginalConstructor() ->getMock(); $tag1->expects($this->any()) @@ -609,7 +610,7 @@ class FilesReportPluginTest extends \Test\TestCase { ->method('isUserVisible') ->will($this->returnValue(true)); - $tag2 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag') + $tag2 = $this->getMockBuilder(ISystemTag::class) ->disableOriginalConstructor() ->getMock(); $tag2->expects($this->any()) @@ -637,7 +638,7 @@ class FilesReportPluginTest extends \Test\TestCase { ->method('isAdmin') ->will($this->returnValue(false)); - $tag1 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag') + $tag1 = $this->getMockBuilder(ISystemTag::class) ->disableOriginalConstructor() ->getMock(); $tag1->expects($this->any()) @@ -647,7 +648,7 @@ class FilesReportPluginTest extends \Test\TestCase { ->method('isUserVisible') ->will($this->returnValue(true)); - $tag2 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag') + $tag2 = $this->getMockBuilder(ISystemTag::class) ->disableOriginalConstructor() ->getMock(); $tag2->expects($this->any()) diff --git a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php index e7ab94ac926..fe6cbd97829 100644 --- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php @@ -25,8 +25,12 @@ */ namespace OCA\DAV\Tests\unit\Connector\Sabre; +use OC\Files\FileInfo; use OC\Files\View; +use OCP\Files\Mount\IMountPoint; use OCP\Files\Storage; +use OCP\Share\IManager; +use OCP\Share\IShare; /** * Class NodeTest @@ -53,7 +57,7 @@ class NodeTest extends \Test\TestCase { * @dataProvider davPermissionsProvider */ public function testDavPermissions($permissions, $type, $shared, $mounted, $expected) { - $info = $this->getMockBuilder('\OC\Files\FileInfo') + $info = $this->getMockBuilder(FileInfo::class) ->disableOriginalConstructor() ->setMethods(array('getPermissions', 'isShared', 'isMounted', 'getType')) ->getMock(); @@ -126,12 +130,12 @@ class NodeTest extends \Test\TestCase { ->getMock(); $storage->method('getPermissions')->willReturn($permissions); - $mountpoint = $this->getMockBuilder('\OCP\Files\Mount\IMountPoint') + $mountpoint = $this->getMockBuilder(IMountPoint::class) ->disableOriginalConstructor() ->getMock(); $mountpoint->method('getMountPoint')->willReturn('myPath'); - $shareManager = $this->getMockBuilder('OCP\Share\IManager')->disableOriginalConstructor()->getMock(); - $share = $this->getMockBuilder('OCP\Share\IShare')->disableOriginalConstructor()->getMock(); + $shareManager = $this->getMockBuilder(IManager::class)->disableOriginalConstructor()->getMock(); + $share = $this->getMockBuilder(IShare::class)->disableOriginalConstructor()->getMock(); if ($user === null) { $shareManager->expects($this->never())->method('getShareByToken'); @@ -142,7 +146,7 @@ class NodeTest extends \Test\TestCase { $share->expects($this->once())->method('getPermissions')->willReturn($permissions); } - $info = $this->getMockBuilder('\OC\Files\FileInfo') + $info = $this->getMockBuilder(FileInfo::class) ->disableOriginalConstructor() ->setMethods(['getStorage', 'getType', 'getMountPoint']) ->getMock(); diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php index c9c55adc9e8..d1b37541dc3 100644 --- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php @@ -31,6 +31,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre; use OC\Files\FileInfo; use OC\Files\Filesystem; +use OC\Files\Mount\Manager; use OC\Files\Storage\Temporary; use OC\Files\View; use OCA\DAV\Connector\Sabre\Directory; @@ -159,13 +160,13 @@ class ObjectTreeTest extends \Test\TestCase { $rootNode = $this->getMockBuilder(Directory::class) ->disableOriginalConstructor() ->getMock(); - $mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager') + $mountManager = $this->getMockBuilder(Manager::class) ->disableOriginalConstructor() ->getMock(); $view = $this->getMockBuilder(View::class) ->disableOriginalConstructor() ->getMock(); - $fileInfo = $this->getMockBuilder('\OCP\Files\FileInfo') + $fileInfo = $this->getMockBuilder(FileInfo::class) ->disableOriginalConstructor() ->getMock(); $fileInfo->expects($this->once()) @@ -287,7 +288,7 @@ class ObjectTreeTest extends \Test\TestCase { $rootNode = $this->getMockBuilder(Directory::class) ->disableOriginalConstructor() ->getMock(); - $mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager') + $mountManager = $this->getMockBuilder(Manager::class) ->getMock(); $tree = new \OCA\DAV\Connector\Sabre\ObjectTree(); @@ -314,7 +315,7 @@ class ObjectTreeTest extends \Test\TestCase { $rootNode = $this->getMockBuilder(Directory::class) ->disableOriginalConstructor() ->getMock(); - $mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager') + $mountManager = $this->getMockBuilder(Manager::class) ->getMock(); $tree = new \OCA\DAV\Connector\Sabre\ObjectTree(); diff --git a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php index d29080539e6..927178996c9 100644 --- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php @@ -176,7 +176,7 @@ class QuotaPluginTest extends TestCase { public function testCheckQuotaChunkedOk($quota, $chunkTotalSize, $headers) { $this->init($quota, 'sub/test.txt'); - $mockChunking = $this->getMockBuilder('\OC_FileChunking') + $mockChunking = $this->getMockBuilder(\OC_FileChunking::class) ->disableOriginalConstructor() ->getMock(); $mockChunking->expects($this->once()) @@ -212,7 +212,7 @@ class QuotaPluginTest extends TestCase { public function testCheckQuotaChunkedFail($quota, $chunkTotalSize, $headers) { $this->init($quota, 'sub/test.txt'); - $mockChunking = $this->getMockBuilder('\OC_FileChunking') + $mockChunking = $this->getMockBuilder(\OC_FileChunking::class) ->disableOriginalConstructor() ->getMock(); $mockChunking->expects($this->once()) diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php index 7c735ca2334..57be6e5a9e2 100644 --- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php @@ -25,10 +25,12 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre; use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Connector\Sabre\File; +use OCA\DAV\Connector\Sabre\Node; use OCP\Files\Folder; use OCP\IUser; use OCP\IUserSession; use OCP\Share\IManager; +use OCP\Share\IShare; use Sabre\DAV\Tree; class SharesPluginTest extends \Test\TestCase { @@ -99,7 +101,7 @@ class SharesPluginTest extends \Test\TestCase { * @dataProvider sharesGetPropertiesDataProvider */ public function testGetProperties($shareTypes) { - $sabreNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') + $sabreNode = $this->getMockBuilder(Node::class) ->disableOriginalConstructor() ->getMock(); $sabreNode->expects($this->any()) @@ -214,7 +216,7 @@ class SharesPluginTest extends \Test\TestCase { ->will($this->returnValue($node)); $dummyShares = array_map(function($type) { - $share = $this->getMockBuilder('\OCP\Share\IShare')->getMock(); + $share = $this->getMockBuilder(IShare::class)->getMock(); $share->expects($this->any()) ->method('getShareType') ->will($this->returnValue($type)); diff --git a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php index 48d02cad690..af156310887 100644 --- a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php @@ -26,6 +26,9 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre; use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Connector\Sabre\File; +use OCA\DAV\Connector\Sabre\Node; +use OCP\ITagManager; +use OCP\ITags; use Sabre\DAV\Tree; /** @@ -71,10 +74,10 @@ class TagsPluginTest extends \Test\TestCase { $this->tree = $this->getMockBuilder(Tree::class) ->disableOriginalConstructor() ->getMock(); - $this->tagger = $this->getMockBuilder('\OCP\ITags') + $this->tagger = $this->getMockBuilder(ITags::class) ->disableOriginalConstructor() ->getMock(); - $this->tagManager = $this->getMockBuilder('\OCP\ITagManager') + $this->tagManager = $this->getMockBuilder(ITagManager::class) ->disableOriginalConstructor() ->getMock(); $this->tagManager->expects($this->any()) @@ -89,7 +92,7 @@ class TagsPluginTest extends \Test\TestCase { * @dataProvider tagsGetPropertiesDataProvider */ public function testGetProperties($tags, $requestedProperties, $expectedProperties) { - $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') + $node = $this->getMockBuilder(Node::class) ->disableOriginalConstructor() ->getMock(); $node->expects($this->any()) @@ -264,7 +267,7 @@ class TagsPluginTest extends \Test\TestCase { public function testUpdateTags() { // this test will replace the existing tags "tagremove" with "tag1" and "tag2" // and keep "tagkeep" - $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') + $node = $this->getMockBuilder(Node::class) ->disableOriginalConstructor() ->getMock(); $node->expects($this->any()) @@ -315,7 +318,7 @@ class TagsPluginTest extends \Test\TestCase { } public function testUpdateTagsFromScratch() { - $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') + $node = $this->getMockBuilder(Node::class) ->disableOriginalConstructor() ->getMock(); $node->expects($this->any()) @@ -363,7 +366,7 @@ class TagsPluginTest extends \Test\TestCase { public function testUpdateFav() { // this test will replace the existing tags "tagremove" with "tag1" and "tag2" // and keep "tagkeep" - $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') + $node = $this->getMockBuilder(Node::class) ->disableOriginalConstructor() ->getMock(); $node->expects($this->any()) |