summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-10-24 15:26:53 +0200
committerMorris Jobke <hey@morrisjobke.de>2017-10-24 17:45:32 +0200
commit43e498844e8c1aa519a19238d2cf3d6b95e1aab0 (patch)
tree59510ef2ffc6c1fd1fd92475013b108f1da2bfeb /apps/files_sharing
parentb1f77aca4effec99387481a831910d4870ae2ffc (diff)
downloadnextcloud-server-43e498844e8c1aa519a19238d2cf3d6b95e1aab0.tar.gz
nextcloud-server-43e498844e8c1aa519a19238d2cf3d6b95e1aab0.zip
Use ::class in test mocks
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/tests/ApiTest.php6
-rw-r--r--apps/files_sharing/tests/CapabilitiesTest.php3
-rw-r--r--apps/files_sharing/tests/Controller/ShareAPIControllerTest.php104
-rw-r--r--apps/files_sharing/tests/Controller/ShareControllerTest.php26
-rw-r--r--apps/files_sharing/tests/External/ManagerTest.php3
-rw-r--r--apps/files_sharing/tests/MountProviderTest.php8
6 files changed, 80 insertions, 70 deletions
diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php
index 1b629f66a81..8a976108b3f 100644
--- a/apps/files_sharing/tests/ApiTest.php
+++ b/apps/files_sharing/tests/ApiTest.php
@@ -35,6 +35,8 @@ use OCP\AppFramework\OCS\OCSBadRequestException;
use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCS\OCSForbiddenException;
use OCP\AppFramework\OCS\OCSNotFoundException;
+use OCP\IL10N;
+use OCP\IRequest;
/**
* Class ApiTest
@@ -96,7 +98,7 @@ class ApiTest extends TestCase {
* @return \OCA\Files_Sharing\Controller\ShareAPIController
*/
private function createOCS($userId) {
- $l = $this->getMockBuilder('\OCP\IL10N')->getMock();
+ $l = $this->getMockBuilder(IL10N::class)->getMock();
$l->method('t')
->will($this->returnCallback(function($text, $parameters = []) {
return vsprintf($text, $parameters);
@@ -104,7 +106,7 @@ class ApiTest extends TestCase {
return new ShareAPIController(
self::APP_NAME,
- $this->getMockBuilder('OCP\IRequest')->getMock(),
+ $this->getMockBuilder(IRequest::class)->getMock(),
$this->shareManager,
\OC::$server->getGroupManager(),
\OC::$server->getUserManager(),
diff --git a/apps/files_sharing/tests/CapabilitiesTest.php b/apps/files_sharing/tests/CapabilitiesTest.php
index 1747bbc4ed2..e65131bf45f 100644
--- a/apps/files_sharing/tests/CapabilitiesTest.php
+++ b/apps/files_sharing/tests/CapabilitiesTest.php
@@ -24,6 +24,7 @@
namespace OCA\Files_Sharing\Tests;
use OCA\Files_Sharing\Capabilities;
+use OCP\IConfig;
/**
@@ -54,7 +55,7 @@ class CapabilitiesTest extends \Test\TestCase {
* @return string[]
*/
private function getResults(array $map) {
- $config = $this->getMockBuilder('\OCP\IConfig')->disableOriginalConstructor()->getMock();
+ $config = $this->getMockBuilder(IConfig::class)->disableOriginalConstructor()->getMock();
$config->method('getAppValue')->will($this->returnValueMap($map));
$cap = new Capabilities($config);
$result = $this->getFilesSharingPart($cap->getCapabilities());
diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
index 45134df36b7..14852b3354f 100644
--- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
@@ -25,7 +25,9 @@ namespace OCA\Files_Sharing\Tests\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCS\OCSNotFoundException;
+use OCP\Files\File;
use OCP\Files\Folder;
+use OCP\Files\Storage;
use OCP\IL10N;
use OCA\Files_Sharing\Controller\ShareAPIController;
use OCP\Files\NotFoundException;
@@ -156,7 +158,7 @@ class ShareAPIControllerTest extends TestCase {
}
public function testDeleteShare() {
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$share = $this->newShare();
$share->setSharedBy($this->currentUser)
@@ -187,7 +189,7 @@ class ShareAPIControllerTest extends TestCase {
* @expectedExceptionMessage could not delete share
*/
public function testDeleteShareLocked() {
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$share = $this->newShare();
$share->setSharedBy($this->currentUser)
@@ -464,15 +466,15 @@ class ShareAPIControllerTest extends TestCase {
->method('linkToRouteAbsolute')
->willReturn('url');
- $initiator = $this->getMockBuilder('OCP\IUser')->getMock();
+ $initiator = $this->getMockBuilder(IUser::class)->getMock();
$initiator->method('getUID')->willReturn('initiatorId');
$initiator->method('getDisplayName')->willReturn('initiatorDisplay');
- $owner = $this->getMockBuilder('OCP\IUser')->getMock();
+ $owner = $this->getMockBuilder(IUser::class)->getMock();
$owner->method('getUID')->willReturn('ownerId');
$owner->method('getDisplayName')->willReturn('ownerDisplay');
- $user = $this->getMockBuilder('OCP\IUser')->getMock();
+ $user = $this->getMockBuilder(IUser::class)->getMock();
$user->method('getUID')->willReturn('userId');
$user->method('getDisplayName')->willReturn('userDisplay');
@@ -526,7 +528,7 @@ class ShareAPIControllerTest extends TestCase {
$share = $this->getMockBuilder('OCP\Share\IShare')->getMock();
$share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER);
- $share->method('getSharedWith')->willReturn($this->getMockBuilder('OCP\IUser')->getMock());
+ $share->method('getSharedWith')->willReturn($this->getMockBuilder(IUser::class)->getMock());
$this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share]));
$share = $this->getMockBuilder('OCP\Share\IShare')->getMock();
@@ -579,7 +581,7 @@ class ShareAPIControllerTest extends TestCase {
* @expectedExceptionMessage Wrong path, file/folder doesn't exist
*/
public function testCreateShareInvalidPath() {
- $userFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $userFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
->method('getUserFolder')
->with('currentUser')
@@ -601,13 +603,13 @@ class ShareAPIControllerTest extends TestCase {
$share = $this->newShare();
$this->shareManager->method('newShare')->willReturn($share);
- $userFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $userFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
->method('getUserFolder')
->with('currentUser')
->willReturn($userFolder);
- $path = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $path = $this->getMockBuilder(File::class)->getMock();
$userFolder->expects($this->once())
->method('get')
->with('valid-path')
@@ -628,13 +630,13 @@ class ShareAPIControllerTest extends TestCase {
$share = $this->newShare();
$this->shareManager->method('newShare')->willReturn($share);
- $userFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $userFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
->method('getUserFolder')
->with('currentUser')
->willReturn($userFolder);
- $path = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $path = $this->getMockBuilder(File::class)->getMock();
$storage = $this->getMockBuilder('OCP\Files\Storage')->getMock();
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
@@ -660,13 +662,13 @@ class ShareAPIControllerTest extends TestCase {
$share = $this->newShare();
$this->shareManager->method('newShare')->willReturn($share);
- $userFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $userFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
->method('getUserFolder')
->with('currentUser')
->willReturn($userFolder);
- $path = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $path = $this->getMockBuilder(File::class)->getMock();
$storage = $this->getMockBuilder('OCP\Files\Storage')->getMock();
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
@@ -705,13 +707,13 @@ class ShareAPIControllerTest extends TestCase {
])->setMethods(['formatShare'])
->getMock();
- $userFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $userFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
->method('getUserFolder')
->with('currentUser')
->willReturn($userFolder);
- $path = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $path = $this->getMockBuilder(File::class)->getMock();
$storage = $this->getMockBuilder('OCP\Files\Storage')->getMock();
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
@@ -759,13 +761,13 @@ class ShareAPIControllerTest extends TestCase {
$this->shareManager->method('createShare')->will($this->returnArgument(0));
$this->shareManager->method('allowGroupSharing')->willReturn(true);
- $userFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $userFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
->method('getUserFolder')
->with('currentUser')
->willReturn($userFolder);
- $path = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $path = $this->getMockBuilder(File::class)->getMock();
$storage = $this->getMockBuilder('OCP\Files\Storage')->getMock();
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
@@ -811,13 +813,13 @@ class ShareAPIControllerTest extends TestCase {
['shareWith', null, 'validGroup'],
]));
- $userFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $userFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
->method('getUserFolder')
->with('currentUser')
->willReturn($userFolder);
- $path = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $path = $this->getMockBuilder(Folder::class)->getMock();
$storage = $this->getMockBuilder('OCP\Files\Storage')->getMock();
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
@@ -863,13 +865,13 @@ class ShareAPIControllerTest extends TestCase {
$share = $this->newShare();
$this->shareManager->method('newShare')->willReturn($share);
- $userFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $userFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
->method('getUserFolder')
->with('currentUser')
->willReturn($userFolder);
- $path = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $path = $this->getMockBuilder(Folder::class)->getMock();
$storage = $this->getMockBuilder('OCP\Files\Storage')->getMock();
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
@@ -901,7 +903,7 @@ class ShareAPIControllerTest extends TestCase {
['shareType', '-1', \OCP\Share::SHARE_TYPE_LINK],
]));
- $path = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $path = $this->getMockBuilder(Folder::class)->getMock();
$storage = $this->getMockBuilder('OCP\Files\Storage')->getMock();
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
@@ -920,7 +922,7 @@ class ShareAPIControllerTest extends TestCase {
* @expectedExceptionMessage Public upload disabled by the administrator
*/
public function testCreateShareLinkNoPublicUpload() {
- $path = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $path = $this->getMockBuilder(Folder::class)->getMock();
$storage = $this->getMockBuilder('OCP\Files\Storage')->getMock();
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
@@ -940,7 +942,7 @@ class ShareAPIControllerTest extends TestCase {
* @expectedExceptionMessage Public upload is only possible for publicly shared folders
*/
public function testCreateShareLinkPublicUploadFile() {
- $path = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $path = $this->getMockBuilder(File::class)->getMock();
$storage = $this->getMockBuilder('OCP\Files\Storage')->getMock();
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
@@ -959,7 +961,7 @@ class ShareAPIControllerTest extends TestCase {
public function testCreateShareLinkPublicUploadFolder() {
$ocs = $this->mockFormatShare();
- $path = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $path = $this->getMockBuilder(Folder::class)->getMock();
$storage = $this->getMockBuilder('OCP\Files\Storage')->getMock();
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
@@ -993,7 +995,7 @@ class ShareAPIControllerTest extends TestCase {
public function testCreateShareLinkPassword() {
$ocs = $this->mockFormatShare();
- $path = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $path = $this->getMockBuilder(Folder::class)->getMock();
$storage = $this->getMockBuilder('OCP\Files\Storage')->getMock();
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
@@ -1037,7 +1039,7 @@ class ShareAPIControllerTest extends TestCase {
['password', '', ''],
]));
- $path = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $path = $this->getMockBuilder(Folder::class)->getMock();
$storage = $this->getMockBuilder('OCP\Files\Storage')->getMock();
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
@@ -1078,7 +1080,7 @@ class ShareAPIControllerTest extends TestCase {
public function testCreateShareInvalidExpireDate() {
$ocs = $this->mockFormatShare();
- $path = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $path = $this->getMockBuilder(Folder::class)->getMock();
$storage = $this->getMockBuilder('OCP\Files\Storage')->getMock();
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
@@ -1117,13 +1119,13 @@ class ShareAPIControllerTest extends TestCase {
])->setMethods(['formatShare'])
->getMock();
- $userFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $userFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
->method('getUserFolder')
->with('currentUser')
->willReturn($userFolder);
- $path = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $path = $this->getMockBuilder(Folder::class)->getMock();
$storage = $this->getMockBuilder('OCP\Files\Storage')->getMock();
$storage->method('instanceOfStorage')
->with('OCA\Files_Sharing\External\Storage')
@@ -1153,7 +1155,7 @@ class ShareAPIControllerTest extends TestCase {
* @expectedExceptionMessage Wrong share ID, share doesn't exist
*/
public function testUpdateShareCantAccess() {
- $node = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $node = $this->getMockBuilder(Folder::class)->getMock();
$share = $this->newShare();
$share->setNode($node);
@@ -1171,7 +1173,7 @@ class ShareAPIControllerTest extends TestCase {
* @expectedExceptionMessage Wrong or no update parameter given
*/
public function testUpdateNoParametersLink() {
- $node = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $node = $this->getMockBuilder(Folder::class)->getMock();
$share = $this->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_ALL)
->setSharedBy($this->currentUser)
@@ -1192,7 +1194,7 @@ class ShareAPIControllerTest extends TestCase {
* @expectedExceptionMessage Wrong or no update parameter given
*/
public function testUpdateNoParametersOther() {
- $node = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $node = $this->getMockBuilder(Folder::class)->getMock();
$share = $this->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_ALL)
->setSharedBy($this->currentUser)
@@ -1248,7 +1250,7 @@ class ShareAPIControllerTest extends TestCase {
public function testUpdateLinkShareSet() {
$ocs = $this->mockFormatShare();
- $folder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $folder = $this->getMockBuilder(Folder::class)->getMock();
$share = \OC::$server->getShareManager()->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_ALL)
@@ -1286,7 +1288,7 @@ class ShareAPIControllerTest extends TestCase {
public function testUpdateLinkShareEnablePublicUpload($permissions, $publicUpload, $expireDate, $password) {
$ocs = $this->mockFormatShare();
- $folder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $folder = $this->getMockBuilder(Folder::class)->getMock();
$share = \OC::$server->getShareManager()->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_ALL)
@@ -1321,7 +1323,7 @@ class ShareAPIControllerTest extends TestCase {
public function testUpdateLinkShareInvalidDate() {
$ocs = $this->mockFormatShare();
- $folder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $folder = $this->getMockBuilder(Folder::class)->getMock();
$share = \OC::$server->getShareManager()->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_ALL)
@@ -1359,7 +1361,7 @@ class ShareAPIControllerTest extends TestCase {
public function testUpdateLinkSharePublicUploadNotAllowed($permissions, $publicUpload, $expireDate, $password) {
$ocs = $this->mockFormatShare();
- $folder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $folder = $this->getMockBuilder(Folder::class)->getMock();
$share = \OC::$server->getShareManager()->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_ALL)
@@ -1380,7 +1382,7 @@ class ShareAPIControllerTest extends TestCase {
public function testUpdateLinkSharePublicUploadOnFile() {
$ocs = $this->mockFormatShare();
- $file = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $file = $this->getMockBuilder(File::class)->getMock();
$share = \OC::$server->getShareManager()->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_ALL)
@@ -1400,7 +1402,7 @@ class ShareAPIControllerTest extends TestCase {
$date = new \DateTime('2000-01-01');
$date->setTime(0,0,0);
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$share = $this->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_ALL)
->setSharedBy($this->currentUser)
@@ -1434,7 +1436,7 @@ class ShareAPIControllerTest extends TestCase {
public function testUpdateLinkShareExpireDateDoesNotChangeOther() {
$ocs = $this->mockFormatShare();
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$share = $this->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_ALL)
->setSharedBy($this->currentUser)
@@ -1473,7 +1475,7 @@ class ShareAPIControllerTest extends TestCase {
$date = new \DateTime('2000-01-01');
- $folder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $folder = $this->getMockBuilder(Folder::class)->getMock();
$share = \OC::$server->getShareManager()->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_ALL)
@@ -1510,7 +1512,7 @@ class ShareAPIControllerTest extends TestCase {
$date = new \DateTime('2000-01-01');
- $folder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $folder = $this->getMockBuilder(Folder::class)->getMock();
$share = \OC::$server->getShareManager()->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_ALL)
@@ -1546,7 +1548,7 @@ class ShareAPIControllerTest extends TestCase {
$date = new \DateTime('2000-01-01');
- $folder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $folder = $this->getMockBuilder(Folder::class)->getMock();
$share = \OC::$server->getShareManager()->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_ALL)
@@ -1580,7 +1582,7 @@ class ShareAPIControllerTest extends TestCase {
public function testUpdateOtherPermissions() {
$ocs = $this->mockFormatShare();
- $file = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $file = $this->getMockBuilder(File::class)->getMock();
$share = \OC::$server->getShareManager()->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_ALL)
@@ -1750,9 +1752,9 @@ class ShareAPIControllerTest extends TestCase {
}
public function dataFormatShare() {
- $file = $this->getMockBuilder('\OCP\Files\File')->getMock();
- $folder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
- $parent = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $file = $this->getMockBuilder(File::class)->getMock();
+ $folder = $this->getMockBuilder(Folder::class)->getMock();
+ $parent = $this->getMockBuilder(Folder::class)->getMock();
$file->method('getMimeType')->willReturn('myMimeType');
$folder->method('getMimeType')->willReturn('myFolderMimeType');
@@ -1769,18 +1771,18 @@ class ShareAPIControllerTest extends TestCase {
$cache = $this->getMockBuilder('OCP\Files\Cache\ICache')->getMock();
$cache->method('getNumericStorageId')->willReturn(100);
- $storage = $this->getMockBuilder('\OCP\Files\Storage')->getMock();
+ $storage = $this->getMockBuilder(Storage::class)->getMock();
$storage->method('getId')->willReturn('storageId');
$storage->method('getCache')->willReturn($cache);
$file->method('getStorage')->willReturn($storage);
$folder->method('getStorage')->willReturn($storage);
- $owner = $this->getMockBuilder('\OCP\IUser')->getMock();
+ $owner = $this->getMockBuilder(IUser::class)->getMock();
$owner->method('getDisplayName')->willReturn('ownerDN');
- $initiator = $this->getMockBuilder('\OCP\IUser')->getMock();
+ $initiator = $this->getMockBuilder(IUser::class)->getMock();
$initiator->method('getDisplayName')->willReturn('initiatorDN');
- $recipient = $this->getMockBuilder('\OCP\IUser')->getMock();
+ $recipient = $this->getMockBuilder(IUser::class)->getMock();
$recipient->method('getDisplayName')->willReturn('recipientDN');
$result = [];
diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php
index 7a017b5e3b7..d1b30d77f32 100644
--- a/apps/files_sharing/tests/Controller/ShareControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php
@@ -35,6 +35,12 @@ use OC\Files\Filesystem;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\Files_Sharing\Controller\ShareController;
use OCP\AppFramework\Http\DataResponse;
+use OCP\IConfig;
+use OCP\IL10N;
+use OCP\ILogger;
+use OCP\IPreview;
+use OCP\IRequest;
+use OCP\IUser;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Http\RedirectResponse;
@@ -83,11 +89,11 @@ class ShareControllerTest extends \Test\TestCase {
$this->appName = 'files_sharing';
$this->shareManager = $this->getMockBuilder('\OC\Share20\Manager')->disableOriginalConstructor()->getMock();
- $this->urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')->getMock();
- $this->session = $this->getMockBuilder('\OCP\ISession')->getMock();
- $this->previewManager = $this->getMockBuilder('\OCP\IPreview')->getMock();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
- $this->userManager = $this->getMockBuilder('\OCP\IUserManager')->getMock();
+ $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock();
+ $this->session = $this->getMockBuilder(ISession::class)->getMock();
+ $this->previewManager = $this->getMockBuilder(IPreview::class)->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
+ $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
$this->federatedShareProvider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider')
->disableOriginalConstructor()->getMock();
$this->federatedShareProvider->expects($this->any())
@@ -98,11 +104,11 @@ class ShareControllerTest extends \Test\TestCase {
$this->shareController = new \OCA\Files_Sharing\Controller\ShareController(
$this->appName,
- $this->getMockBuilder('\OCP\IRequest')->getMock(),
+ $this->getMockBuilder(IRequest::class)->getMock(),
$this->config,
$this->urlGenerator,
$this->userManager,
- $this->getMockBuilder('\OCP\ILogger')->getMock(),
+ $this->getMockBuilder(ILogger::class)->getMock(),
$this->getMockBuilder('\OCP\Activity\IManager')->getMock(),
$this->shareManager,
$this->session,
@@ -110,7 +116,7 @@ class ShareControllerTest extends \Test\TestCase {
$this->getMockBuilder('\OCP\Files\IRootFolder')->getMock(),
$this->federatedShareProvider,
$this->eventDispatcher,
- $this->getMockBuilder('\OCP\IL10N')->getMock(),
+ $this->getMockBuilder(IL10N::class)->getMock(),
$this->getMockBuilder('\OCP\Defaults')->getMock()
);
@@ -320,7 +326,7 @@ class ShareControllerTest extends \Test\TestCase {
public function testShowShare() {
- $owner = $this->getMockBuilder('OCP\IUser')->getMock();
+ $owner = $this->getMockBuilder(IUser::class)->getMock();
$owner->method('getDisplayName')->willReturn('ownerDisplay');
$owner->method('getUID')->willReturn('ownerUID');
@@ -412,7 +418,7 @@ class ShareControllerTest extends \Test\TestCase {
* @expectedException \OCP\Files\NotFoundException
*/
public function testShowShareInvalid() {
- $owner = $this->getMockBuilder('OCP\IUser')->getMock();
+ $owner = $this->getMockBuilder(IUser::class)->getMock();
$owner->method('getDisplayName')->willReturn('ownerDisplay');
$owner->method('getUID')->willReturn('ownerUID');
diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php
index 9f60261c203..37319dd17b2 100644
--- a/apps/files_sharing/tests/External/ManagerTest.php
+++ b/apps/files_sharing/tests/External/ManagerTest.php
@@ -27,7 +27,6 @@ namespace OCA\Files_Sharing\Tests\External;
use OC\Federation\CloudIdManager;
use OC\Files\Storage\StorageFactory;
-use OCA\FederatedFileSharing\DiscoveryManager;
use OCA\Files_Sharing\External\Manager;
use OCA\Files_Sharing\External\MountProvider;
use OCA\Files_Sharing\Tests\TestCase;
@@ -68,7 +67,7 @@ class ManagerTest extends TestCase {
$this->createUser($this->uid, '');
$this->user = \OC::$server->getUserManager()->get($this->uid);
$this->mountManager = new \OC\Files\Mount\Manager();
- $this->clientService = $this->getMockBuilder('\OCP\Http\Client\IClientService')
+ $this->clientService = $this->getMockBuilder(IClientService::class)
->disableOriginalConstructor()->getMock();
$this->manager = new Manager(
diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php
index 04476987a32..68c62427e34 100644
--- a/apps/files_sharing/tests/MountProviderTest.php
+++ b/apps/files_sharing/tests/MountProviderTest.php
@@ -60,11 +60,11 @@ class MountProviderTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('OCP\IConfig')->getMock();
- $this->user = $this->getMockBuilder('OCP\IUser')->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
+ $this->user = $this->getMockBuilder(IUser::class)->getMock();
$this->loader = $this->getMockBuilder('OCP\Files\Storage\IStorageFactory')->getMock();
- $this->shareManager = $this->getMockBuilder('\OCP\Share\IManager')->getMock();
- $this->logger = $this->getMockBuilder('\OCP\ILogger')->getMock();
+ $this->shareManager = $this->getMockBuilder(IManager::class)->getMock();
+ $this->logger = $this->getMockBuilder(ILogger::class)->getMock();
$this->provider = new MountProvider($this->config, $this->shareManager, $this->logger);
}