summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/comments/tests/Unit/Controller/NotificationsTest.php36
-rw-r--r--apps/comments/tests/Unit/Notification/ListenerTest.php16
-rw-r--r--apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php2
-rw-r--r--apps/dav/tests/unit/CalDAV/CalendarTest.php2
-rw-r--r--apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php2
-rw-r--r--apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php6
-rw-r--r--apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php12
-rw-r--r--apps/dav/tests/unit/CardDAV/AddressBookTest.php8
-rw-r--r--apps/dav/tests/unit/CardDAV/CardDavBackendTest.php2
-rw-r--r--apps/dav/tests/unit/CardDAV/ContactsManagerTest.php7
-rw-r--r--apps/dav/tests/unit/CardDAV/ConverterTest.php4
-rw-r--r--apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php2
-rw-r--r--apps/dav/tests/unit/CardDAV/SyncServiceTest.php21
-rw-r--r--apps/dav/tests/unit/Comments/CommentsNodeTest.php35
-rw-r--r--apps/dav/tests/unit/Comments/CommentsPluginTest.php80
-rw-r--r--apps/dav/tests/unit/Comments/EntityCollectionTest.php29
-rw-r--r--apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php16
-rw-r--r--apps/dav/tests/unit/Comments/RootCollectionTest.php15
-rw-r--r--apps/dav/tests/unit/Connector/PublicAuthTest.php6
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/AuthTest.php41
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php2
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php14
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php10
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php5
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php10
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FileTest.php34
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php24
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php54
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php2
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/NodeTest.php8
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php12
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php4
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php3
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php32
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php14
-rw-r--r--apps/dav/tests/unit/DAV/Sharing/PluginTest.php2
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php3
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php3
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php35
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php9
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php3
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php13
-rw-r--r--apps/encryption/tests/Command/TestEnableMasterKey.php3
-rw-r--r--apps/encryption/tests/Controller/RecoveryControllerTest.php9
-rw-r--r--apps/encryption/tests/Controller/SettingsControllerTest.php6
-rw-r--r--apps/encryption/tests/Controller/StatusControllerTest.php3
-rw-r--r--apps/encryption/tests/Crypto/CryptTest.php6
-rw-r--r--apps/encryption/tests/Crypto/EncryptAllTest.php15
-rw-r--r--apps/encryption/tests/Crypto/EncryptionTest.php6
-rw-r--r--apps/encryption/tests/Hooks/UserHooksTest.php3
-rw-r--r--apps/encryption/tests/MigrationTest.php5
-rw-r--r--apps/encryption/tests/Settings/AdminTest.php12
-rw-r--r--apps/federatedfilesharing/tests/AddressHandlerTest.php4
-rw-r--r--apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php7
-rw-r--r--apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php8
-rw-r--r--apps/federatedfilesharing/tests/FederatedShareProviderTest.php31
-rw-r--r--apps/files/tests/Controller/ViewControllerTest.php34
-rw-r--r--apps/files/tests/Settings/AdminTest.php2
-rw-r--r--apps/files_external/tests/Auth/AuthMechanismTest.php12
-rw-r--r--apps/files_external/tests/Backend/BackendTest.php7
-rw-r--r--apps/files_external/tests/Controller/StoragesControllerTest.php6
-rw-r--r--apps/files_external/tests/FrontendDefinitionTraitTest.php13
-rw-r--r--apps/files_external/tests/Service/BackendServiceTest.php10
-rw-r--r--apps/files_external/tests/Service/StoragesServiceTest.php8
-rw-r--r--apps/files_external/tests/Settings/SectionTest.php4
-rw-r--r--apps/files_external/tests/StorageConfigTest.php9
-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
-rw-r--r--apps/files_trashbin/tests/ExpirationTest.php5
-rw-r--r--apps/files_trashbin/tests/StorageTest.php3
-rw-r--r--apps/files_versions/tests/ExpirationTest.php3
-rw-r--r--apps/provisioning_api/tests/Controller/AppsControllerTest.php5
-rw-r--r--apps/provisioning_api/tests/Controller/GroupsControllerTest.php6
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php146
-rw-r--r--apps/sharebymail/tests/ShareByMailProviderTest.php8
-rw-r--r--apps/theming/tests/Controller/IconControllerTest.php4
-rw-r--r--apps/theming/tests/IconBuilderTest.php2
-rw-r--r--apps/theming/tests/ImageManagerTest.php2
-rw-r--r--apps/theming/tests/Settings/AdminTest.php6
-rw-r--r--apps/user_ldap/tests/Settings/AdminTest.php2
-rw-r--r--apps/user_ldap/tests/User/UserTest.php7
-rw-r--r--apps/workflowengine/tests/Check/AbstractStringCheckTest.php3
-rw-r--r--apps/workflowengine/tests/Check/RequestRemoteAddressTest.php6
-rw-r--r--apps/workflowengine/tests/Check/RequestTimeTest.php3
88 files changed, 690 insertions, 532 deletions
diff --git a/apps/comments/tests/Unit/Controller/NotificationsTest.php b/apps/comments/tests/Unit/Controller/NotificationsTest.php
index e887900a615..2c34971f4b7 100644
--- a/apps/comments/tests/Unit/Controller/NotificationsTest.php
+++ b/apps/comments/tests/Unit/Controller/NotificationsTest.php
@@ -22,7 +22,17 @@
namespace OCA\Comments\Tests\Unit\Controller;
use OCA\Comments\Controller\Notifications;
+use OCP\Comments\IComment;
+use OCP\Comments\ICommentsManager;
use OCP\Comments\NotFoundException;
+use OCP\Files\Folder;
+use OCP\Files\Node;
+use OCP\IRequest;
+use OCP\IURLGenerator;
+use OCP\IUser;
+use OCP\IUserSession;
+use OCP\Notification\IManager;
+use OCP\Notification\INotification;
use Test\TestCase;
class NotificationsTest extends TestCase {
@@ -44,24 +54,24 @@ class NotificationsTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->commentsManager = $this->getMockBuilder('\OCP\Comments\ICommentsManager')->getMock();
- $this->folder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
- $this->session = $this->getMockBuilder('\OCP\IUserSession')->getMock();
- $this->notificationManager = $this->getMockBuilder('\OCP\Notification\IManager')->getMock();
+ $this->commentsManager = $this->getMockBuilder(ICommentsManager::class)->getMock();
+ $this->folder = $this->getMockBuilder(Folder::class)->getMock();
+ $this->session = $this->getMockBuilder(IUserSession::class)->getMock();
+ $this->notificationManager = $this->getMockBuilder(IManager::class)->getMock();
$this->notificationsController = new Notifications(
'comments',
- $this->getMockBuilder('\OCP\IRequest')->getMock(),
+ $this->getMockBuilder(IRequest::class)->getMock(),
$this->commentsManager,
$this->folder,
- $this->getMockBuilder('\OCP\IURLGenerator')->getMock(),
+ $this->getMockBuilder(IURLGenerator::class)->getMock(),
$this->notificationManager,
$this->session
);
}
public function testViewSuccess() {
- $comment = $this->getMockBuilder('\OCP\Comments\IComment')->getMock();
+ $comment = $this->getMockBuilder(IComment::class)->getMock();
$comment->expects($this->any())
->method('getObjectType')
->will($this->returnValue('files'));
@@ -71,7 +81,7 @@ class NotificationsTest extends TestCase {
->with('42')
->will($this->returnValue($comment));
- $file = $this->getMockBuilder('\OCP\Files\Node')->getMock();
+ $file = $this->getMockBuilder(Node::class)->getMock();
$this->folder->expects($this->once())
->method('getById')
@@ -79,9 +89,9 @@ class NotificationsTest extends TestCase {
$this->session->expects($this->once())
->method('getUser')
- ->will($this->returnValue($this->getMockBuilder('\OCP\IUser')->getMock()));
+ ->will($this->returnValue($this->getMockBuilder(IUser::class)->getMock()));
- $notification = $this->getMockBuilder('\OCP\Notification\INotification')->getMock();
+ $notification = $this->getMockBuilder(INotification::class)->getMock();
$notification->expects($this->any())
->method($this->anything())
->will($this->returnValue($notification));
@@ -119,7 +129,7 @@ class NotificationsTest extends TestCase {
}
public function testViewNoFile() {
- $comment = $this->getMockBuilder('\OCP\Comments\IComment')->getMock();
+ $comment = $this->getMockBuilder(IComment::class)->getMock();
$comment->expects($this->any())
->method('getObjectType')
->will($this->returnValue('files'));
@@ -135,9 +145,9 @@ class NotificationsTest extends TestCase {
$this->session->expects($this->once())
->method('getUser')
- ->will($this->returnValue($this->getMockBuilder('\OCP\IUser')->getMock()));
+ ->will($this->returnValue($this->getMockBuilder(IUser::class)->getMock()));
- $notification = $this->getMockBuilder('\OCP\Notification\INotification')->getMock();
+ $notification = $this->getMockBuilder(INotification::class)->getMock();
$notification->expects($this->any())
->method($this->anything())
->will($this->returnValue($notification));
diff --git a/apps/comments/tests/Unit/Notification/ListenerTest.php b/apps/comments/tests/Unit/Notification/ListenerTest.php
index ef84d1c60de..cbe2b633429 100644
--- a/apps/comments/tests/Unit/Notification/ListenerTest.php
+++ b/apps/comments/tests/Unit/Notification/ListenerTest.php
@@ -71,7 +71,7 @@ class ListenerTest extends TestCase {
*/
public function testEvaluate($eventType, $notificationMethod) {
/** @var IComment|\PHPUnit_Framework_MockObject_MockObject $comment */
- $comment = $this->getMockBuilder('\OCP\Comments\IComment')->getMock();
+ $comment = $this->getMockBuilder(IComment::class)->getMock();
$comment->expects($this->any())
->method('getObjectType')
->will($this->returnValue('files'));
@@ -90,7 +90,7 @@ class ListenerTest extends TestCase {
]);
/** @var CommentsEvent|\PHPUnit_Framework_MockObject_MockObject $event */
- $event = $this->getMockBuilder('\OCP\Comments\CommentsEvent')
+ $event = $this->getMockBuilder(CommentsEvent::class)
->disableOriginalConstructor()
->getMock();
$event->expects($this->once())
@@ -101,7 +101,7 @@ class ListenerTest extends TestCase {
->will($this->returnValue($eventType));
/** @var INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
- $notification = $this->getMockBuilder('\OCP\Notification\INotification')->getMock();
+ $notification = $this->getMockBuilder(INotification::class)->getMock();
$notification->expects($this->any())
->method($this->anything())
->will($this->returnValue($notification));
@@ -136,7 +136,7 @@ class ListenerTest extends TestCase {
*/
public function testEvaluateNoMentions($eventType) {
/** @var IComment|\PHPUnit_Framework_MockObject_MockObject $comment */
- $comment = $this->getMockBuilder('\OCP\Comments\IComment')->getMock();
+ $comment = $this->getMockBuilder(IComment::class)->getMock();
$comment->expects($this->any())
->method('getObjectType')
->will($this->returnValue('files'));
@@ -148,7 +148,7 @@ class ListenerTest extends TestCase {
->willReturn([]);
/** @var CommentsEvent|\PHPUnit_Framework_MockObject_MockObject $event */
- $event = $this->getMockBuilder('\OCP\Comments\CommentsEvent')
+ $event = $this->getMockBuilder(CommentsEvent::class)
->disableOriginalConstructor()
->getMock();
$event->expects($this->once())
@@ -173,7 +173,7 @@ class ListenerTest extends TestCase {
public function testEvaluateUserDoesNotExist() {
/** @var IComment|\PHPUnit_Framework_MockObject_MockObject $comment */
- $comment = $this->getMockBuilder('\OCP\Comments\IComment')->getMock();
+ $comment = $this->getMockBuilder(IComment::class)->getMock();
$comment->expects($this->any())
->method('getObjectType')
->will($this->returnValue('files'));
@@ -185,7 +185,7 @@ class ListenerTest extends TestCase {
->willReturn([[ 'type' => 'user', 'id' => 'foobar']]);
/** @var CommentsEvent|\PHPUnit_Framework_MockObject_MockObject $event */
- $event = $this->getMockBuilder('\OCP\Comments\CommentsEvent')
+ $event = $this->getMockBuilder(CommentsEvent::class)
->disableOriginalConstructor()
->getMock();
$event->expects($this->once())
@@ -196,7 +196,7 @@ class ListenerTest extends TestCase {
->will($this->returnValue(CommentsEvent::EVENT_ADD));
/** @var INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
- $notification = $this->getMockBuilder('\OCP\Notification\INotification')->getMock();
+ $notification = $this->getMockBuilder(INotification::class)->getMock();
$notification->expects($this->any())
->method($this->anything())
->will($this->returnValue($notification));
diff --git a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php
index 3f3b744e5ab..eef69aadf40 100644
--- a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php
+++ b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php
@@ -66,7 +66,7 @@ abstract class AbstractCalDavBackend extends TestCase {
$this->userManager = $this->createMock(IUserManager::class);
$this->groupManager = $this->createMock(IGroupManager::class);
$this->dispatcher = $this->createMock(EventDispatcherInterface::class);
- $this->principal = $this->getMockBuilder('OCA\DAV\Connector\Sabre\Principal')
+ $this->principal = $this->getMockBuilder(Principal::class)
->disableOriginalConstructor()
->setMethods(['getPrincipalByPath', 'getGroupMembership'])
->getMock();
diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php
index d9ea25b268c..9ad773dd747 100644
--- a/apps/dav/tests/unit/CalDAV/CalendarTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php
@@ -38,7 +38,7 @@ class CalendarTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->l10n = $this->getMockBuilder('\OCP\IL10N')
+ $this->l10n = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()->getMock();
$this->l10n
->expects($this->any())
diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php
index ec767f3dbd8..29ab503e082 100644
--- a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php
+++ b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php
@@ -65,7 +65,7 @@ class PublicCalendarRootTest extends TestCase {
$this->publicCalendarRoot = new PublicCalendarRoot($this->backend);
- $this->l10n = $this->getMockBuilder('\OCP\IL10N')
+ $this->l10n = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()->getMock();
}
diff --git a/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php b/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php
index 69de507dac5..b60c567e9f1 100644
--- a/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php
+++ b/apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php
@@ -29,14 +29,14 @@ class PluginTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->
+ $this->config = $this->getMockBuilder(IConfig::class)->
disableOriginalConstructor()->
getMock();
$this->config->expects($this->any())->method('getSystemValue')
->with($this->equalTo('secret'))
->willReturn('mysecret');
- $this->urlGenerator = $this->getMockBuilder('OCP\IURLGenerator')->
+ $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->
disableOriginalConstructor()->
getMock();
@@ -46,7 +46,7 @@ class PluginTest extends TestCase {
$root = new SimpleCollection('calendars');
$this->server = new Server($root);
/** @var SimpleCollection $node */
- $this->book = $this->getMockBuilder('OCA\DAV\CalDAV\Calendar')->
+ $this->book = $this->getMockBuilder(Calendar::class)->
disableOriginalConstructor()->
getMock();
$this->book->method('getName')->willReturn('cal1');
diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
index 56eb00406da..894617781b5 100644
--- a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
@@ -38,11 +38,11 @@ class IMipPluginTest extends TestCase {
public function testDelivery() {
$mailMessage = new \OC\Mail\Message(new \Swift_Message());
/** @var Mailer | \PHPUnit_Framework_MockObject_MockObject $mailer */
- $mailer = $this->getMockBuilder('OC\Mail\Mailer')->disableOriginalConstructor()->getMock();
+ $mailer = $this->getMockBuilder(Mailer::class)->disableOriginalConstructor()->getMock();
$mailer->method('createMessage')->willReturn($mailMessage);
$mailer->expects($this->once())->method('send');
/** @var ILogger | \PHPUnit_Framework_MockObject_MockObject $logger */
- $logger = $this->getMockBuilder('OC\Log')->disableOriginalConstructor()->getMock();
+ $logger = $this->getMockBuilder(ILogger::class)->disableOriginalConstructor()->getMock();
$timeFactory = $this->getMockBuilder(ITimeFactory::class)->disableOriginalConstructor()->getMock();
$timeFactory->method('getTime')->willReturn(1);
@@ -70,11 +70,11 @@ class IMipPluginTest extends TestCase {
public function testFailedDelivery() {
$mailMessage = new \OC\Mail\Message(new \Swift_Message());
/** @var Mailer | \PHPUnit_Framework_MockObject_MockObject $mailer */
- $mailer = $this->getMockBuilder('OC\Mail\Mailer')->disableOriginalConstructor()->getMock();
+ $mailer = $this->getMockBuilder(Mailer::class)->disableOriginalConstructor()->getMock();
$mailer->method('createMessage')->willReturn($mailMessage);
$mailer->method('send')->willThrowException(new \Exception());
/** @var ILogger | \PHPUnit_Framework_MockObject_MockObject $logger */
- $logger = $this->getMockBuilder('OC\Log')->disableOriginalConstructor()->getMock();
+ $logger = $this->getMockBuilder(ILogger::class)->disableOriginalConstructor()->getMock();
$timeFactory = $this->getMockBuilder(ITimeFactory::class)->disableOriginalConstructor()->getMock();
$timeFactory->method('getTime')->willReturn(1);
@@ -105,7 +105,7 @@ class IMipPluginTest extends TestCase {
public function testNoMessageSendForPastEvents($veventParams, $expectsMail) {
$mailMessage = new \OC\Mail\Message(new \Swift_Message());
/** @var Mailer | \PHPUnit_Framework_MockObject_MockObject $mailer */
- $mailer = $this->getMockBuilder('OC\Mail\Mailer')->disableOriginalConstructor()->getMock();
+ $mailer = $this->getMockBuilder(Mailer::class)->disableOriginalConstructor()->getMock();
$mailer->method('createMessage')->willReturn($mailMessage);
if ($expectsMail) {
$mailer->expects($this->once())->method('send');
@@ -113,7 +113,7 @@ class IMipPluginTest extends TestCase {
$mailer->expects($this->never())->method('send');
}
/** @var ILogger | \PHPUnit_Framework_MockObject_MockObject $logger */
- $logger = $this->getMockBuilder('OC\Log')->disableOriginalConstructor()->getMock();
+ $logger = $this->getMockBuilder(ILogger::class)->disableOriginalConstructor()->getMock();
$timeFactory = $this->getMockBuilder(ITimeFactory::class)->disableOriginalConstructor()->getMock();
$timeFactory->method('getTime')->willReturn(1496912528);
diff --git a/apps/dav/tests/unit/CardDAV/AddressBookTest.php b/apps/dav/tests/unit/CardDAV/AddressBookTest.php
index 132fa4796db..0e3d7c6f9b1 100644
--- a/apps/dav/tests/unit/CardDAV/AddressBookTest.php
+++ b/apps/dav/tests/unit/CardDAV/AddressBookTest.php
@@ -33,7 +33,7 @@ class AddressBookTest extends TestCase {
public function testDelete() {
/** @var \PHPUnit_Framework_MockObject_MockObject | CardDavBackend $backend */
- $backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')->disableOriginalConstructor()->getMock();
+ $backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
$backend->expects($this->once())->method('updateShares');
$backend->expects($this->any())->method('getShares')->willReturn([
['href' => 'principal:user2']
@@ -55,7 +55,7 @@ class AddressBookTest extends TestCase {
*/
public function testDeleteFromGroup() {
/** @var \PHPUnit_Framework_MockObject_MockObject | CardDavBackend $backend */
- $backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')->disableOriginalConstructor()->getMock();
+ $backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
$backend->expects($this->never())->method('updateShares');
$backend->expects($this->any())->method('getShares')->willReturn([
['href' => 'principal:group2']
@@ -77,7 +77,7 @@ class AddressBookTest extends TestCase {
*/
public function testPropPatch() {
/** @var \PHPUnit_Framework_MockObject_MockObject | CardDavBackend $backend */
- $backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')->disableOriginalConstructor()->getMock();
+ $backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
'{DAV:}displayname' => 'Test address book',
@@ -95,7 +95,7 @@ class AddressBookTest extends TestCase {
*/
public function testAcl($expectsWrite, $readOnlyValue, $hasOwnerSet) {
/** @var \PHPUnit_Framework_MockObject_MockObject | CardDavBackend $backend */
- $backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')->disableOriginalConstructor()->getMock();
+ $backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
$backend->expects($this->any())->method('applyShareAcl')->willReturnArgument(1);
$calendarInfo = [
'{DAV:}displayname' => 'Test address book',
diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
index 992445392d5..a8c0ce9d9c7 100644
--- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
+++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
@@ -85,7 +85,7 @@ class CardDavBackendTest extends TestCase {
$this->userManager = $this->createMock(IUserManager::class);
$this->groupManager = $this->createMock(IGroupManager::class);
- $this->principal = $this->getMockBuilder('OCA\DAV\Connector\Sabre\Principal')
+ $this->principal = $this->getMockBuilder(Principal::class)
->disableOriginalConstructor()
->setMethods(['getPrincipalByPath', 'getGroupMembership'])
->getMock();
diff --git a/apps/dav/tests/unit/CardDAV/ContactsManagerTest.php b/apps/dav/tests/unit/CardDAV/ContactsManagerTest.php
index a6f0384cc38..7a773ac999c 100644
--- a/apps/dav/tests/unit/CardDAV/ContactsManagerTest.php
+++ b/apps/dav/tests/unit/CardDAV/ContactsManagerTest.php
@@ -28,16 +28,17 @@ use OCA\DAV\CardDAV\CardDavBackend;
use OCA\DAV\CardDAV\ContactsManager;
use OCP\Contacts\IManager;
use OCP\IL10N;
+use OCP\IURLGenerator;
use Test\TestCase;
class ContactsManagerTest extends TestCase {
public function test() {
/** @var IManager | \PHPUnit_Framework_MockObject_MockObject $cm */
- $cm = $this->getMockBuilder('OCP\Contacts\IManager')->disableOriginalConstructor()->getMock();
+ $cm = $this->getMockBuilder(IManager::class)->disableOriginalConstructor()->getMock();
$cm->expects($this->exactly(2))->method('registerAddressBook');
- $urlGenerator = $this->getMockBuilder('OCP\IUrlGenerator')->disableOriginalConstructor()->getMock();
+ $urlGenerator = $this->getMockBuilder(IURLGenerator::class)->disableOriginalConstructor()->getMock();
/** @var CardDavBackend | \PHPUnit_Framework_MockObject_MockObject $backEnd */
- $backEnd = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')->disableOriginalConstructor()->getMock();
+ $backEnd = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
$backEnd->method('getAddressBooksForUser')->willReturn([
['{DAV:}displayname' => 'Test address book', 'uri' => 'default'],
]);
diff --git a/apps/dav/tests/unit/CardDAV/ConverterTest.php b/apps/dav/tests/unit/CardDAV/ConverterTest.php
index 39853cfd5c8..e4b78485114 100644
--- a/apps/dav/tests/unit/CardDAV/ConverterTest.php
+++ b/apps/dav/tests/unit/CardDAV/ConverterTest.php
@@ -49,12 +49,12 @@ class ConverterTest extends TestCase {
$this->databaseConnection = $this->getMockBuilder('OCP\IDBConnection')->getMock();
$this->eventDispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
->disableOriginalConstructor()->getMock();
- $this->accountManager = $this->getMockBuilder('OC\Accounts\AccountManager')
+ $this->accountManager = $this->getMockBuilder(AccountManager::class)
->disableOriginalConstructor()->getMock();
}
public function getAccountManager(IUser $user) {
- $accountManager = $this->getMockBuilder('OC\Accounts\AccountManager')
+ $accountManager = $this->getMockBuilder(AccountManager::class)
->disableOriginalConstructor()->getMock();
$accountManager->expects($this->any())->method('getUser')->willReturn(
[
diff --git a/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php b/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php
index 00049075865..8536deb8e6e 100644
--- a/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php
+++ b/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php
@@ -51,7 +51,7 @@ class PluginTest extends TestCase {
$authBackend->method('isDavAuthenticated')->willReturn(true);
/** @var IRequest $request */
- $request = $this->getMockBuilder('OCP\IRequest')->disableOriginalConstructor()->getMock();
+ $request = $this->getMockBuilder(IRequest::class)->disableOriginalConstructor()->getMock();
$this->plugin = new Plugin($authBackend, $request);
$root = new SimpleCollection('root');
diff --git a/apps/dav/tests/unit/CardDAV/SyncServiceTest.php b/apps/dav/tests/unit/CardDAV/SyncServiceTest.php
index 32f8a2424b1..debc9238067 100644
--- a/apps/dav/tests/unit/CardDAV/SyncServiceTest.php
+++ b/apps/dav/tests/unit/CardDAV/SyncServiceTest.php
@@ -28,6 +28,7 @@ namespace OCA\DAV\Tests\unit\CardDAV;
use OC\Accounts\AccountManager;
use OCA\DAV\CardDAV\CardDavBackend;
use OCA\DAV\CardDAV\SyncService;
+use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
use Test\TestCase;
@@ -75,9 +76,9 @@ class SyncServiceTest extends TestCase {
$backend->expects($this->at(1))->method('getAddressBooksByUri')->willReturn([]);
/** @var IUserManager $userManager */
- $userManager = $this->getMockBuilder('OCP\IUserManager')->disableOriginalConstructor()->getMock();
- $logger = $this->getMockBuilder('OCP\ILogger')->disableOriginalConstructor()->getMock();
- $accountManager = $this->getMockBuilder('OC\Accounts\AccountManager')->disableOriginalConstructor()->getMock();
+ $userManager = $this->getMockBuilder(IUserManager::class)->disableOriginalConstructor()->getMock();
+ $logger = $this->getMockBuilder(ILogger::class)->disableOriginalConstructor()->getMock();
+ $accountManager = $this->getMockBuilder(AccountManager::class)->disableOriginalConstructor()->getMock();
$ss = new SyncService($backend, $userManager, $logger, $accountManager);
$book = $ss->ensureSystemAddressBookExists('principals/users/adam', 'contacts', []);
}
@@ -85,7 +86,7 @@ class SyncServiceTest extends TestCase {
public function testUpdateAndDeleteUser() {
/** @var CardDavBackend | \PHPUnit_Framework_MockObject_MockObject $backend */
$backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
- $logger = $this->getMockBuilder('OCP\ILogger')->disableOriginalConstructor()->getMock();
+ $logger = $this->getMockBuilder(ILogger::class)->disableOriginalConstructor()->getMock();
$backend->expects($this->once())->method('createCard');
$backend->expects($this->once())->method('updateCard');
@@ -96,15 +97,15 @@ class SyncServiceTest extends TestCase {
]);
/** @var IUserManager | \PHPUnit_Framework_MockObject_MockObject $userManager */
- $userManager = $this->getMockBuilder('OCP\IUserManager')->disableOriginalConstructor()->getMock();
+ $userManager = $this->getMockBuilder(IUserManager::class)->disableOriginalConstructor()->getMock();
/** @var IUser | \PHPUnit_Framework_MockObject_MockObject $user */
- $user = $this->getMockBuilder('OCP\IUser')->disableOriginalConstructor()->getMock();
+ $user = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$user->method('getBackendClassName')->willReturn('unittest');
$user->method('getUID')->willReturn('test-user');
$user->method('getCloudId')->willReturn('cloudId');
$user->method('getDisplayName')->willReturn('test-user');
- $accountManager = $this->getMockBuilder('OC\Accounts\AccountManager')->disableOriginalConstructor()->getMock();
+ $accountManager = $this->getMockBuilder(AccountManager::class)->disableOriginalConstructor()->getMock();
$accountManager->expects($this->any())->method('getUser')
->willReturn([
AccountManager::PROPERTY_DISPLAYNAME =>
@@ -174,9 +175,9 @@ class SyncServiceTest extends TestCase {
* @return SyncService|\PHPUnit_Framework_MockObject_MockObject
*/
private function getSyncServiceMock($backend, $response) {
- $userManager = $this->getMockBuilder('OCP\IUserManager')->disableOriginalConstructor()->getMock();
- $logger = $this->getMockBuilder('OCP\ILogger')->disableOriginalConstructor()->getMock();
- $accountManager = $this->getMockBuilder('OC\Accounts\AccountManager')->disableOriginalConstructor()->getMock();
+ $userManager = $this->getMockBuilder(IUserManager::class)->disableOriginalConstructor()->getMock();
+ $logger = $this->getMockBuilder(ILogger::class)->disableOriginalConstructor()->getMock();
+ $accountManager = $this->getMockBuilder(AccountManager::class)->disableOriginalConstructor()->getMock();
/** @var SyncService | \PHPUnit_Framework_MockObject_MockObject $ss */
$ss = $this->getMockBuilder(SyncService::class)
->setMethods(['ensureSystemAddressBookExists', 'requestSyncReport', 'download', 'getCertPath'])
diff --git a/apps/dav/tests/unit/Comments/CommentsNodeTest.php b/apps/dav/tests/unit/Comments/CommentsNodeTest.php
index 226aa57598c..57a15a6dc76 100644
--- a/apps/dav/tests/unit/Comments/CommentsNodeTest.php
+++ b/apps/dav/tests/unit/Comments/CommentsNodeTest.php
@@ -26,8 +26,13 @@
namespace OCA\DAV\Tests\unit\Comments;
use OCA\DAV\Comments\CommentNode;
+use OCP\Comments\IComment;
use OCP\Comments\ICommentsManager;
use OCP\Comments\MessageTooLongException;
+use OCP\ILogger;
+use OCP\IUser;
+use OCP\IUserManager;
+use OCP\IUserSession;
class CommentsNodeTest extends \Test\TestCase {
@@ -43,19 +48,19 @@ class CommentsNodeTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->commentsManager = $this->getMockBuilder('\OCP\Comments\ICommentsManager')
+ $this->commentsManager = $this->getMockBuilder(ICommentsManager::class)
->disableOriginalConstructor()
->getMock();
- $this->comment = $this->getMockBuilder('\OCP\Comments\IComment')
+ $this->comment = $this->getMockBuilder(IComment::class)
->disableOriginalConstructor()
->getMock();
- $this->userManager = $this->getMockBuilder('\OCP\IUserManager')
+ $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()
->getMock();
- $this->userSession = $this->getMockBuilder('\OCP\IUserSession')
+ $this->userSession = $this->getMockBuilder(IUserSession::class)
->disableOriginalConstructor()
->getMock();
- $this->logger = $this->getMockBuilder('\OCP\ILogger')
+ $this->logger = $this->getMockBuilder(ILogger::class)
->disableOriginalConstructor()
->getMock();
@@ -69,7 +74,7 @@ class CommentsNodeTest extends \Test\TestCase {
}
public function testDelete() {
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@@ -104,7 +109,7 @@ class CommentsNodeTest extends \Test\TestCase {
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testDeleteForbidden() {
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@@ -156,7 +161,7 @@ class CommentsNodeTest extends \Test\TestCase {
public function testUpdateComment() {
$msg = 'Hello Earth';
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@@ -188,13 +193,13 @@ class CommentsNodeTest extends \Test\TestCase {
}
/**
- * @expectedException Exception
+ * @expectedException \Exception
* @expectedExceptionMessage buh!
*/
public function testUpdateCommentLogException() {
$msg = null;
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@@ -233,7 +238,7 @@ class CommentsNodeTest extends \Test\TestCase {
* @expectedExceptionMessage Message exceeds allowed character limit of
*/
public function testUpdateCommentMessageTooLongException() {
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@@ -273,7 +278,7 @@ class CommentsNodeTest extends \Test\TestCase {
public function testUpdateForbiddenByUser() {
$msg = 'HaXX0r';
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@@ -308,7 +313,7 @@ class CommentsNodeTest extends \Test\TestCase {
public function testUpdateForbiddenByType() {
$msg = 'HaXX0r';
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@@ -461,7 +466,7 @@ class CommentsNodeTest extends \Test\TestCase {
->method('getObjectId')
->will($this->returnValue($expected[$ns . 'objectId']));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->once())
@@ -515,7 +520,7 @@ class CommentsNodeTest extends \Test\TestCase {
$this->userSession->expects($this->once())
->method('getUser')
->will($this->returnValue(
- $this->getMockBuilder('\OCP\IUser')
+ $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock()
));
diff --git a/apps/dav/tests/unit/Comments/CommentsPluginTest.php b/apps/dav/tests/unit/Comments/CommentsPluginTest.php
index 265afad96c3..e0f7a09a502 100644
--- a/apps/dav/tests/unit/Comments/CommentsPluginTest.php
+++ b/apps/dav/tests/unit/Comments/CommentsPluginTest.php
@@ -27,19 +27,27 @@ namespace OCA\DAV\Tests\unit\Comments;
use OC\Comments\Comment;
use OCA\DAV\Comments\CommentsPlugin as CommentsPluginImplementation;
+use OCA\DAV\Comments\EntityCollection;
use OCP\Comments\IComment;
+use OCP\Comments\ICommentsManager;
+use OCP\IUser;
+use OCP\IUserSession;
+use Sabre\DAV\INode;
+use Sabre\DAV\Tree;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
class CommentsPluginTest extends \Test\TestCase {
/** @var \Sabre\DAV\Server */
private $server;
- /** @var \Sabre\DAV\Tree */
+ /** @var Tree */
private $tree;
- /** @var \OCP\Comments\ICommentsManager */
+ /** @var ICommentsManager */
private $commentsManager;
- /** @var \OCP\IUserSession */
+ /** @var IUserSession */
private $userSession;
/** @var CommentsPluginImplementation */
@@ -47,7 +55,7 @@ class CommentsPluginTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->tree = $this->getMockBuilder('\Sabre\DAV\Tree')
+ $this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
->getMock();
@@ -56,10 +64,10 @@ class CommentsPluginTest extends \Test\TestCase {
->setMethods(['getRequestUri'])
->getMock();
- $this->commentsManager = $this->getMockBuilder('\OCP\Comments\ICommentsManager')
+ $this->commentsManager = $this->getMockBuilder(ICommentsManager::class)
->disableOriginalConstructor()
->getMock();
- $this->userSession = $this->getMockBuilder('\OCP\IUserSession')
+ $this->userSession = $this->getMockBuilder(IUserSession::class)
->disableOriginalConstructor()
->getMock();
@@ -85,14 +93,14 @@ class CommentsPluginTest extends \Test\TestCase {
$requestData = json_encode($commentData);
- $user = $this->getMockBuilder('OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->once())
->method('getUID')
->will($this->returnValue('alice'));
- $node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
+ $node = $this->getMockBuilder(EntityCollection::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
@@ -124,11 +132,11 @@ class CommentsPluginTest extends \Test\TestCase {
->with('/' . $path)
->will($this->returnValue($node));
- $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();
@@ -181,13 +189,13 @@ class CommentsPluginTest extends \Test\TestCase {
$path = 'comments/files/666';
- $user = $this->getMockBuilder('OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->never())
->method('getUID');
- $node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
+ $node = $this->getMockBuilder(EntityCollection::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->never())
@@ -210,11 +218,11 @@ class CommentsPluginTest extends \Test\TestCase {
->with('/' . $path)
->will($this->throwException(new \Sabre\DAV\Exception\NotFound()));
- $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();
@@ -265,13 +273,13 @@ class CommentsPluginTest extends \Test\TestCase {
$requestData = json_encode($commentData);
- $user = $this->getMockBuilder('OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->never())
->method('getUID');
- $node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
+ $node = $this->getMockBuilder(EntityCollection::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
@@ -296,11 +304,11 @@ class CommentsPluginTest extends \Test\TestCase {
->with('/' . $path)
->will($this->returnValue($node));
- $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();
@@ -353,13 +361,13 @@ class CommentsPluginTest extends \Test\TestCase {
$requestData = json_encode($commentData);
- $user = $this->getMockBuilder('OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->never())
->method('getUID');
- $node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
+ $node = $this->getMockBuilder(EntityCollection::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
@@ -384,11 +392,11 @@ class CommentsPluginTest extends \Test\TestCase {
->with('/' . $path)
->will($this->returnValue($node));
- $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();
@@ -443,14 +451,14 @@ class CommentsPluginTest extends \Test\TestCase {
$requestData = json_encode($commentData);
- $user = $this->getMockBuilder('OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->once())
->method('getUID')
->will($this->returnValue('alice'));
- $node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
+ $node = $this->getMockBuilder(EntityCollection::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
@@ -478,11 +486,11 @@ class CommentsPluginTest extends \Test\TestCase {
->with('/' . $path)
->will($this->returnValue($node));
- $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();
@@ -537,14 +545,14 @@ class CommentsPluginTest extends \Test\TestCase {
$requestData = json_encode($commentData);
- $user = $this->getMockBuilder('OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->once())
->method('getUID')
->will($this->returnValue('alice'));
- $node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
+ $node = $this->getMockBuilder(EntityCollection::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
@@ -575,11 +583,11 @@ class CommentsPluginTest extends \Test\TestCase {
->with('/' . $path)
->will($this->returnValue($node));
- $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();
@@ -617,7 +625,7 @@ class CommentsPluginTest extends \Test\TestCase {
->method('getNodeForPath')
->with('/' . $path)
->will($this->returnValue(
- $this->getMockBuilder('\Sabre\DAV\INode')
+ $this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock()
));
@@ -640,7 +648,7 @@ class CommentsPluginTest extends \Test\TestCase {
->method('getNodeForPath')
->with('/' . $path)
->will($this->returnValue(
- $this->getMockBuilder('\Sabre\DAV\INode')
+ $this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock()
));
@@ -671,7 +679,7 @@ class CommentsPluginTest extends \Test\TestCase {
]
];
- $node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
+ $node = $this->getMockBuilder(EntityCollection::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
@@ -679,7 +687,7 @@ class CommentsPluginTest extends \Test\TestCase {
->with(5, 10, null)
->will($this->returnValue([]));
- $response = $this->getMockBuilder('Sabre\HTTP\ResponseInterface')
+ $response = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
->getMock();
@@ -726,7 +734,7 @@ class CommentsPluginTest extends \Test\TestCase {
]
];
- $node = $this->getMockBuilder('\OCA\DAV\Comments\EntityCollection')
+ $node = $this->getMockBuilder(EntityCollection::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
@@ -734,7 +742,7 @@ class CommentsPluginTest extends \Test\TestCase {
->with(5, 10, new \DateTime($parameters[2]['value']))
->will($this->returnValue([]));
- $response = $this->getMockBuilder('Sabre\HTTP\ResponseInterface')
+ $response = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/dav/tests/unit/Comments/EntityCollectionTest.php b/apps/dav/tests/unit/Comments/EntityCollectionTest.php
index c4e343d49d4..0cac135843b 100644
--- a/apps/dav/tests/unit/Comments/EntityCollectionTest.php
+++ b/apps/dav/tests/unit/Comments/EntityCollectionTest.php
@@ -24,32 +24,39 @@
namespace OCA\DAV\Tests\unit\Comments;
+use OCA\DAV\Comments\EntityCollection;
+use OCP\Comments\IComment;
+use OCP\Comments\ICommentsManager;
+use OCP\ILogger;
+use OCP\IUserManager;
+use OCP\IUserSession;
+
class EntityCollectionTest extends \Test\TestCase {
/** @var \OCP\Comments\ICommentsManager|\PHPUnit_Framework_MockObject_MockObject */
protected $commentsManager;
- /** @var \OCP\IUserManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
protected $userManager;
- /** @var \OCP\ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
protected $logger;
- /** @var \OCA\DAV\Comments\EntityCollection */
+ /** @var EntityCollection */
protected $collection;
- /** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
protected $userSession;
public function setUp() {
parent::setUp();
- $this->commentsManager = $this->getMockBuilder('\OCP\Comments\ICommentsManager')
+ $this->commentsManager = $this->getMockBuilder(ICommentsManager::class)
->disableOriginalConstructor()
->getMock();
- $this->userManager = $this->getMockBuilder('\OCP\IUserManager')
+ $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()
->getMock();
- $this->userSession = $this->getMockBuilder('\OCP\IUserSession')
+ $this->userSession = $this->getMockBuilder(IUserSession::class)
->disableOriginalConstructor()
->getMock();
- $this->logger = $this->getMockBuilder('\OCP\ILogger')
+ $this->logger = $this->getMockBuilder(ILogger::class)
->disableOriginalConstructor()
->getMock();
@@ -72,7 +79,7 @@ class EntityCollectionTest extends \Test\TestCase {
->method('get')
->with('55')
->will($this->returnValue(
- $this->getMockBuilder('\OCP\Comments\IComment')
+ $this->getMockBuilder(IComment::class)
->disableOriginalConstructor()
->getMock()
));
@@ -98,7 +105,7 @@ class EntityCollectionTest extends \Test\TestCase {
->method('getForObject')
->with('files', '19')
->will($this->returnValue([
- $this->getMockBuilder('\OCP\Comments\IComment')
+ $this->getMockBuilder(IComment::class)
->disableOriginalConstructor()
->getMock()
]));
@@ -115,7 +122,7 @@ class EntityCollectionTest extends \Test\TestCase {
->method('getForObject')
->with('files', '19', 5, 15, $dt)
->will($this->returnValue([
- $this->getMockBuilder('\OCP\Comments\IComment')
+ $this->getMockBuilder(IComment::class)
->disableOriginalConstructor()
->getMock()
]));
diff --git a/apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php b/apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php
index 17c4f70fa7f..c63d95ad533 100644
--- a/apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php
+++ b/apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php
@@ -25,10 +25,14 @@
namespace OCA\DAV\Tests\unit\Comments;
use OCA\DAV\Comments\EntityCollection as EntityCollectionImplemantation;
+use OCP\Comments\ICommentsManager;
+use OCP\ILogger;
+use OCP\IUserManager;
+use OCP\IUserSession;
class EntityTypeCollectionTest extends \Test\TestCase {
- /** @var \OCP\Comments\ICommentsManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICommentsManager|\PHPUnit_Framework_MockObject_MockObject */
protected $commentsManager;
/** @var \OCP\IUserManager|\PHPUnit_Framework_MockObject_MockObject */
protected $userManager;
@@ -36,7 +40,7 @@ class EntityTypeCollectionTest extends \Test\TestCase {
protected $logger;
/** @var \OCA\DAV\Comments\EntityTypeCollection */
protected $collection;
- /** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
protected $userSession;
protected $childMap = [];
@@ -44,16 +48,16 @@ class EntityTypeCollectionTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->commentsManager = $this->getMockBuilder('\OCP\Comments\ICommentsManager')
+ $this->commentsManager = $this->getMockBuilder(ICommentsManager::class)
->disableOriginalConstructor()
->getMock();
- $this->userManager = $this->getMockBuilder('\OCP\IUserManager')
+ $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()
->getMock();
- $this->userSession = $this->getMockBuilder('\OCP\IUserSession')
+ $this->userSession = $this->getMockBuilder(IUserSession::class)
->disableOriginalConstructor()
->getMock();
- $this->logger = $this->getMockBuilder('\OCP\ILogger')
+ $this->logger = $this->getMockBuilder(ILogger::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/dav/tests/unit/Comments/RootCollectionTest.php b/apps/dav/tests/unit/Comments/RootCollectionTest.php
index 95afc42a912..05fb94239b4 100644
--- a/apps/dav/tests/unit/Comments/RootCollectionTest.php
+++ b/apps/dav/tests/unit/Comments/RootCollectionTest.php
@@ -26,6 +26,11 @@ namespace OCA\DAV\Tests\unit\Comments;
use OCA\DAV\Comments\EntityTypeCollection as EntityTypeCollectionImplementation;
use OCP\Comments\CommentsEntityEvent;
+use OCP\Comments\ICommentsManager;
+use OCP\ILogger;
+use OCP\IUser;
+use OCP\IUserManager;
+use OCP\IUserSession;
use Symfony\Component\EventDispatcher\EventDispatcher;
class RootCollectionTest extends \Test\TestCase {
@@ -48,21 +53,21 @@ class RootCollectionTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->user = $this->getMockBuilder('\OCP\IUser')
+ $this->user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
- $this->commentsManager = $this->getMockBuilder('\OCP\Comments\ICommentsManager')
+ $this->commentsManager = $this->getMockBuilder(ICommentsManager::class)
->disableOriginalConstructor()
->getMock();
- $this->userManager = $this->getMockBuilder('\OCP\IUserManager')
+ $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()
->getMock();
- $this->userSession = $this->getMockBuilder('\OCP\IUserSession')
+ $this->userSession = $this->getMockBuilder(IUserSession::class)
->disableOriginalConstructor()
->getMock();
$this->dispatcher = new EventDispatcher();
- $this->logger = $this->getMockBuilder('\OCP\ILogger')
+ $this->logger = $this->getMockBuilder(ILogger::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/dav/tests/unit/Connector/PublicAuthTest.php b/apps/dav/tests/unit/Connector/PublicAuthTest.php
index 41cfc0f8ceb..90401e03853 100644
--- a/apps/dav/tests/unit/Connector/PublicAuthTest.php
+++ b/apps/dav/tests/unit/Connector/PublicAuthTest.php
@@ -53,13 +53,13 @@ class PublicAuthTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $this->session = $this->getMockBuilder('\OCP\ISession')
+ $this->session = $this->getMockBuilder(ISession::class)
->disableOriginalConstructor()
->getMock();
- $this->request = $this->getMockBuilder('\OCP\IRequest')
+ $this->request = $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock();
- $this->shareManager = $this->getMockBuilder('\OCP\Share\IManager')
+ $this->shareManager = $this->getMockBuilder(IManager::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
index dfcb7939799..34998745f77 100644
--- a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
@@ -34,6 +34,7 @@ use OC\User\Session;
use OCP\IRequest;
use OCP\ISession;
use OCP\IUser;
+use Sabre\DAV\Server;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
use Test\TestCase;
@@ -60,16 +61,16 @@ class AuthTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->session = $this->getMockBuilder('\OCP\ISession')
+ $this->session = $this->getMockBuilder(ISession::class)
->disableOriginalConstructor()->getMock();
- $this->userSession = $this->getMockBuilder('\OC\User\Session')
+ $this->userSession = $this->getMockBuilder(Session::class)
->disableOriginalConstructor()->getMock();
- $this->request = $this->getMockBuilder('\OCP\IRequest')
+ $this->request = $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()->getMock();
- $this->twoFactorManager = $this->getMockBuilder('\OC\Authentication\TwoFactorAuth\Manager')
+ $this->twoFactorManager = $this->getMockBuilder(Manager::class)
->disableOriginalConstructor()
->getMock();
- $this->throttler = $this->getMockBuilder('\OC\Security\Bruteforce\Throttler')
+ $this->throttler = $this->getMockBuilder(Throttler::class)
->disableOriginalConstructor()
->getMock();
$this->auth = new \OCA\DAV\Connector\Sabre\Auth(
@@ -112,7 +113,7 @@ class AuthTest extends TestCase {
}
public function testValidateUserPassOfAlreadyDAVAuthenticatedUser() {
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->exactly(2))
@@ -139,7 +140,7 @@ class AuthTest extends TestCase {
}
public function testValidateUserPassOfInvalidDAVAuthenticatedUser() {
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->once())
@@ -166,7 +167,7 @@ class AuthTest extends TestCase {
}
public function testValidateUserPassOfInvalidDAVAuthenticatedUserWithValidPassword() {
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->exactly(3))
@@ -258,7 +259,7 @@ class AuthTest extends TestCase {
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
->will($this->returnValue(null));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -310,7 +311,7 @@ class AuthTest extends TestCase {
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
->will($this->returnValue('LoggedInUser'));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -360,7 +361,7 @@ class AuthTest extends TestCase {
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
->will($this->returnValue('LoggedInUser'));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -414,7 +415,7 @@ class AuthTest extends TestCase {
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
->will($this->returnValue('AnotherUser'));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -460,7 +461,7 @@ class AuthTest extends TestCase {
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
->will($this->returnValue(null));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -494,7 +495,7 @@ class AuthTest extends TestCase {
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
->will($this->returnValue(null));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -529,7 +530,7 @@ class AuthTest extends TestCase {
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
->will($this->returnValue(null));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -549,7 +550,7 @@ class AuthTest extends TestCase {
}
public function testAuthenticateNoBasicAuthenticateHeadersProvided() {
- $server = $this->getMockBuilder('\Sabre\DAV\Server')
+ $server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
$server->httpRequest = $this->getMockBuilder(RequestInterface::class)
@@ -597,7 +598,7 @@ class AuthTest extends TestCase {
->disableOriginalConstructor()
->getMock();
/** @var IUser */
- $user = $this->getMockBuilder('OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->method('getUID')->willReturn('MyTestUser');
@@ -630,7 +631,7 @@ class AuthTest extends TestCase {
}
public function testAuthenticateValidCredentials() {
- $server = $this->getMockBuilder('\Sabre\DAV\Server')
+ $server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
$server->httpRequest = $this->getMockBuilder(RequestInterface::class)
@@ -654,7 +655,7 @@ class AuthTest extends TestCase {
->method('logClientIn')
->with('username', 'password')
->will($this->returnValue(true));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->exactly(3))
@@ -669,7 +670,7 @@ class AuthTest extends TestCase {
}
public function testAuthenticateInvalidCredentials() {
- $server = $this->getMockBuilder('\Sabre\DAV\Server')
+ $server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
$server->httpRequest = $this->getMockBuilder(RequestInterface::class)
diff --git a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php
index eb1689089a4..e80d12979ed 100644
--- a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php
@@ -44,7 +44,7 @@ class BlockLegacyClientPluginTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$this->blockLegacyClientVersionPlugin = new BlockLegacyClientPlugin($this->config);
diff --git a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
index 13e10476a41..c02bd5046d8 100644
--- a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
@@ -25,6 +25,10 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre;
use \OCA\DAV\Connector\Sabre\CommentPropertiesPlugin as CommentPropertiesPluginImplementation;
+use OCA\DAV\Connector\Sabre\File;
+use OCP\Comments\ICommentsManager;
+use OCP\IUser;
+use OCP\IUserSession;
class CommentsPropertiesPluginTest extends \Test\TestCase {
@@ -37,10 +41,10 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->commentsManager = $this->getMockBuilder('\OCP\Comments\ICommentsManager')
+ $this->commentsManager = $this->getMockBuilder(ICommentsManager::class)
->disableOriginalConstructor()
->getMock();
- $this->userSession = $this->getMockBuilder('\OCP\IUserSession')
+ $this->userSession = $this->getMockBuilder(IUserSession::class)
->disableOriginalConstructor()
->getMock();
@@ -103,7 +107,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
* @param $expectedHref
*/
public function testGetCommentsLink($baseUri, $fid, $expectedHref) {
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $node = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
@@ -121,7 +125,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
public function userProvider() {
return [
[
- $this->getMockBuilder('\OCP\IUser')
+ $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock()
],
@@ -134,7 +138,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
* @param $user
*/
public function testGetUnreadCount($user) {
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $node = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
diff --git a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
index f0f4caa07a0..4f51c25741b 100644
--- a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
@@ -31,6 +31,10 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
* See the COPYING-README file.
*/
+use OCP\IUser;
+use Sabre\DAV\File;
+use Sabre\DAV\Tree;
+
/**
* Class CustomPropertiesBackend
*
@@ -63,13 +67,13 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
$this->server = new \Sabre\DAV\Server();
- $this->tree = $this->getMockBuilder('\Sabre\DAV\Tree')
+ $this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
->getMock();
$userId = $this->getUniqueID('testcustompropertiesuser');
- $this->user = $this->getMockBuilder('\OCP\IUser')
+ $this->user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->user->expects($this->any())
@@ -209,7 +213,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
public function testGetPropertiesForDirectory() {
$rootNode = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory');
- $nodeSub = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $nodeSub = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$nodeSub->expects($this->any())
diff --git a/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php b/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php
index 1c2e249e8c0..f16c374a0e1 100644
--- a/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php
@@ -26,6 +26,7 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin;
+use Sabre\DAV\Server;
use Test\TestCase;
/**
@@ -44,8 +45,8 @@ class DummyGetResponsePluginTest extends TestCase {
}
public function testInitialize() {
- /** @var \Sabre\DAV\Server $server */
- $server = $this->getMockBuilder('\Sabre\DAV\Server')
+ /** @var Server $server */
+ $server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
$server
diff --git a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
index abf6e5cf182..1fd2b05c23d 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
@@ -25,6 +25,8 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OCA\DAV\Connector\Sabre\FakeLockerPlugin;
+use Sabre\DAV\INode;
+use Sabre\DAV\Server;
use Sabre\HTTP\Response;
use Test\TestCase;
@@ -43,8 +45,8 @@ class FakeLockerPluginTest extends TestCase {
}
public function testInitialize() {
- /** @var \Sabre\DAV\Server $server */
- $server = $this->getMockBuilder('\Sabre\DAV\Server')
+ /** @var Server $server */
+ $server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
$server
@@ -86,7 +88,7 @@ class FakeLockerPluginTest extends TestCase {
$propFind = $this->getMockBuilder('\Sabre\DAV\PropFind')
->disableOriginalConstructor()
->getMock();
- $node = $this->getMockBuilder('\Sabre\DAV\INode')
+ $node = $this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock();
@@ -155,7 +157,7 @@ class FakeLockerPluginTest extends TestCase {
->disableOriginalConstructor()
->getMock();
$response = new Response();
- $server = $this->getMockBuilder('\Sabre\DAV\Server')
+ $server = $this->getMockBuilder(Server::class)
->getMock();
$this->fakeLockerPlugin->initialize($server);
diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
index e2666d0de27..3a2075941ae 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
@@ -27,7 +27,9 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OC\Files\Storage\Local;
+use OC\Files\View;
use OCP\Files\ForbiddenException;
+use OCP\Files\Storage;
use Test\HookHelper;
use OC\Files\Filesystem;
use OCP\Lock\ILockingProvider;
@@ -70,7 +72,7 @@ class FileTest extends \Test\TestCase {
}
private function getMockStorage() {
- $storage = $this->getMockBuilder('\OCP\Files\Storage')
+ $storage = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()
->getMock();
$storage->expects($this->any())
@@ -151,12 +153,12 @@ class FileTest extends \Test\TestCase {
*/
public function testSimplePutFails($thrownException, $expectedException, $checkPreviousClass = true) {
// setup
- $storage = $this->getMockBuilder('\OC\Files\Storage\Local')
+ $storage = $this->getMockBuilder(Local::class)
->setMethods(['fopen'])
->setConstructorArgs([['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]])
->getMock();
\OC\Files\Filesystem::mount($storage, [], $this->user . '/');
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['getRelativePath', 'resolvePath'])
->getMock();
$view->expects($this->atLeastOnce())
@@ -210,12 +212,12 @@ class FileTest extends \Test\TestCase {
*/
public function testChunkedPutFails($thrownException, $expectedException, $checkPreviousClass = false) {
// setup
- $storage = $this->getMockBuilder('\OC\Files\Storage\Local')
+ $storage = $this->getMockBuilder(Local::class)
->setMethods(['fopen'])
->setConstructorArgs([['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]])
->getMock();
\OC\Files\Filesystem::mount($storage, [], $this->user . '/');
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['getRelativePath', 'resolvePath'])
->getMock();
$view->expects($this->atLeastOnce())
@@ -535,7 +537,7 @@ class FileTest extends \Test\TestCase {
*/
public function testSimplePutFailsSizeCheck() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['rename', 'getRelativePath', 'filesize'])
->getMock();
$view->expects($this->any())
@@ -653,7 +655,7 @@ class FileTest extends \Test\TestCase {
*/
public function testSimplePutInvalidChars() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['getRelativePath'])
->getMock();
$view->expects($this->any())
@@ -690,7 +692,7 @@ class FileTest extends \Test\TestCase {
*/
public function testSetNameInvalidChars() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['getRelativePath'])
->getMock();
@@ -709,7 +711,7 @@ class FileTest extends \Test\TestCase {
*/
public function testUploadAbort() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['rename', 'getRelativePath', 'filesize'])
->getMock();
$view->expects($this->any())
@@ -755,7 +757,7 @@ class FileTest extends \Test\TestCase {
*/
public function testDeleteWhenAllowed() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->getMock();
$view->expects($this->once())
@@ -777,7 +779,7 @@ class FileTest extends \Test\TestCase {
*/
public function testDeleteThrowsWhenDeletionNotAllowed() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->getMock();
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
@@ -795,7 +797,7 @@ class FileTest extends \Test\TestCase {
*/
public function testDeleteThrowsWhenDeletionFailed() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->getMock();
// but fails
@@ -818,7 +820,7 @@ class FileTest extends \Test\TestCase {
*/
public function testDeleteThrowsWhenDeletionThrows() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->getMock();
// but fails
@@ -968,7 +970,7 @@ class FileTest extends \Test\TestCase {
* @expectedException \Sabre\DAV\Exception\ServiceUnavailable
*/
public function testGetFopenFails() {
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['fopen'])
->getMock();
$view->expects($this->atLeastOnce())
@@ -988,7 +990,7 @@ class FileTest extends \Test\TestCase {
* @expectedException \OCA\DAV\Connector\Sabre\Exception\Forbidden
*/
public function testGetFopenThrows() {
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['fopen'])
->getMock();
$view->expects($this->atLeastOnce())
@@ -1008,7 +1010,7 @@ class FileTest extends \Test\TestCase {
* @expectedException \Sabre\DAV\Exception\NotFound
*/
public function testGetThrowsIfNoPermission() {
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['fopen'])
->getMock();
$view->expects($this->never())
diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
index 885f3c23c24..a33ece3c4b3 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
@@ -25,10 +25,16 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OCA\DAV\Connector\Sabre\File;
use OCA\DAV\Connector\Sabre\FilesPlugin;
use OCP\Files\StorageNotAvailableException;
+use OCP\IConfig;
+use OCP\IPreview;
+use OCP\IRequest;
use Sabre\DAV\PropFind;
use Sabre\DAV\PropPatch;
+use Sabre\DAV\Server;
+use Sabre\DAV\Tree;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
use Test\TestCase;
@@ -87,20 +93,20 @@ class FilesPluginTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->server = $this->getMockBuilder('\Sabre\DAV\Server')
+ $this->server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
- $this->tree = $this->getMockBuilder('\Sabre\DAV\Tree')
+ $this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
->getMock();
- $this->config = $this->createMock('\OCP\IConfig');
+ $this->config = $this->createMock(IConfig::class);
$this->config->expects($this->any())->method('getSystemValue')
->with($this->equalTo('data-fingerprint'), $this->equalTo(''))
->willReturn('my_fingerprint');
- $this->request = $this->getMockBuilder('\OCP\IRequest')
+ $this->request = $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock();
- $this->previewManager = $this->getMockBuilder('\OCP\IPreview')
+ $this->previewManager = $this->getMockBuilder(IPreview::class)
->disableOriginalConstructor()
->getMock();
@@ -245,7 +251,7 @@ class FilesPluginTest extends TestCase {
$this->plugin = new FilesPlugin(
$this->tree,
$this->config,
- $this->getMockBuilder('\OCP\IRequest')
+ $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock(),
$this->previewManager,
@@ -311,7 +317,7 @@ class FilesPluginTest extends TestCase {
public function testGetPropertiesForRootDirectory() {
/** @var \OCA\DAV\Connector\Sabre\Directory | \PHPUnit_Framework_MockObject_MockObject $node */
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $node = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())->method('getPath')->willReturn('/');
@@ -347,7 +353,7 @@ class FilesPluginTest extends TestCase {
// $this->expectException(\Sabre\DAV\Exception\NotFound::class);
/** @var \OCA\DAV\Connector\Sabre\Directory|\PHPUnit_Framework_MockObject_MockObject $node */
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $node = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())->method('getPath')->willReturn('/');
@@ -539,7 +545,7 @@ class FilesPluginTest extends TestCase {
->method('getPath')
->will($this->returnValue('test/somefile.xml'));
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $node = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node
diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
index 3ca131dbf6f..374557c6b67 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
@@ -24,9 +24,14 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\FilesReportPlugin as FilesReportPluginImplementation;
+use OCP\Files\File;
+use OCP\IConfig;
use OCP\IPreview;
+use OCP\IRequest;
use OCP\ITagManager;
+use OCP\IUser;
use OCP\IUserSession;
use OCP\SystemTag\ISystemTagObjectMapper;
use OC\Files\View;
@@ -35,6 +40,9 @@ use OCP\IGroupManager;
use OCP\SystemTag\ISystemTagManager;
use OCP\ITags;
use OCP\Files\FileInfo;
+use Sabre\DAV\INode;
+use Sabre\DAV\Tree;
+use Sabre\HTTP\ResponseInterface;
class FilesReportPluginTest extends \Test\TestCase {
/** @var \Sabre\DAV\Server|\PHPUnit_Framework_MockObject_MockObject */
@@ -72,11 +80,11 @@ class FilesReportPluginTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->tree = $this->getMockBuilder('\Sabre\DAV\Tree')
+ $this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
->getMock();
- $this->view = $this->getMockBuilder('\OC\Files\View')
+ $this->view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
@@ -89,15 +97,15 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('getBaseUri')
->will($this->returnValue('http://example.com/owncloud/remote.php/dav'));
- $this->groupManager = $this->getMockBuilder('\OCP\IGroupManager')
+ $this->groupManager = $this->getMockBuilder(IGroupManager::class)
->disableOriginalConstructor()
->getMock();
- $this->userFolder = $this->getMockBuilder('\OCP\Files\Folder')
+ $this->userFolder = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
- $this->previewManager = $this->getMockBuilder('\OCP\IPreview')
+ $this->previewManager = $this->getMockBuilder(IPreview::class)
->disableOriginalConstructor()
->getMock();
@@ -111,7 +119,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->with('files')
->will($this->returnValue($this->privateTags));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -140,7 +148,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('getNodeForPath')
->with('/' . $path)
->will($this->returnValue(
- $this->getMockBuilder('\Sabre\DAV\INode')
+ $this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock()
));
@@ -160,7 +168,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('getNodeForPath')
->with('/' . $path)
->will($this->returnValue(
- $this->getMockBuilder('\Sabre\DAV\INode')
+ $this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock()
));
@@ -206,11 +214,11 @@ class FilesReportPluginTest extends \Test\TestCase {
->with('456', 'files')
->will($this->returnValue(['111', '222', '333']));
- $reportTargetNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $reportTargetNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
- $response = $this->getMockBuilder('Sabre\HTTP\ResponseInterface')
+ $response = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
->getMock();
@@ -230,10 +238,10 @@ class FilesReportPluginTest extends \Test\TestCase {
->with('/' . $path)
->will($this->returnValue($reportTargetNode));
- $filesNode1 = $this->getMockBuilder('\OCP\Files\Folder')
+ $filesNode1 = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
- $filesNode2 = $this->getMockBuilder('\OCP\Files\File')
+ $filesNode2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
@@ -256,21 +264,21 @@ class FilesReportPluginTest extends \Test\TestCase {
}
public function testFindNodesByFileIdsRoot() {
- $filesNode1 = $this->getMockBuilder('\OCP\Files\Folder')
+ $filesNode1 = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
$filesNode1->expects($this->once())
->method('getName')
->will($this->returnValue('first node'));
- $filesNode2 = $this->getMockBuilder('\OCP\Files\File')
+ $filesNode2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$filesNode2->expects($this->once())
->method('getName')
->will($this->returnValue('second node'));
- $reportTargetNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $reportTargetNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$reportTargetNode->expects($this->any())
@@ -297,21 +305,21 @@ class FilesReportPluginTest extends \Test\TestCase {
}
public function testFindNodesByFileIdsSubDir() {
- $filesNode1 = $this->getMockBuilder('\OCP\Files\Folder')
+ $filesNode1 = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
$filesNode1->expects($this->once())
->method('getName')
->will($this->returnValue('first node'));
- $filesNode2 = $this->getMockBuilder('\OCP\Files\File')
+ $filesNode2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$filesNode2->expects($this->once())
->method('getName')
->will($this->returnValue('second node'));
- $reportTargetNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $reportTargetNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$reportTargetNode->expects($this->any())
@@ -319,7 +327,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->will($this->returnValue('/sub1/sub2'));
- $subNode = $this->getMockBuilder('\OCP\Files\Folder')
+ $subNode = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
@@ -353,10 +361,10 @@ class FilesReportPluginTest extends \Test\TestCase {
$fileInfo = $this->createMock(FileInfo::class);
$fileInfo->method('isReadable')->willReturn(true);
- $node1 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $node1 = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
- $node2 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $node2 = $this->getMockBuilder(\OCA\DAV\Connector\Sabre\File::class)
->disableOriginalConstructor()
->getMock();
@@ -378,7 +386,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->will($this->returnValue('/sub/node2'));
$node2->method('getFileInfo')->willReturn($fileInfo);
- $config = $this->getMockBuilder('\OCP\IConfig')
+ $config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
@@ -386,7 +394,7 @@ class FilesReportPluginTest extends \Test\TestCase {
new \OCA\DAV\Connector\Sabre\FilesPlugin(
$this->tree,
$config,
- $this->getMockBuilder('\OCP\IRequest')
+ $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock(),
$this->previewManager
diff --git a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php
index 43c32299523..b028cb8e6ac 100644
--- a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php
@@ -42,7 +42,7 @@ class MaintenancePluginTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->maintenancePlugin = new MaintenancePlugin($this->config);
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
index 0aa3fe6101d..e7ab94ac926 100644
--- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
@@ -25,6 +25,8 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OC\Files\View;
+use OCP\Files\Storage;
/**
* Class NodeTest
@@ -67,7 +69,7 @@ class NodeTest extends \Test\TestCase {
$info->expects($this->any())
->method('getType')
->will($this->returnValue($type));
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
@@ -119,7 +121,7 @@ class NodeTest extends \Test\TestCase {
* @dataProvider sharePermissionsProvider
*/
public function testSharePermissions($type, $user, $permissions, $expected) {
- $storage = $this->getMockBuilder('\OCP\Files\Storage')
+ $storage = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()
->getMock();
$storage->method('getPermissions')->willReturn($permissions);
@@ -149,7 +151,7 @@ class NodeTest extends \Test\TestCase {
$info->method('getType')->willReturn($type);
$info->method('getMountPoint')->willReturn($mountpoint);
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
index 53f60bd0f1c..c9c55adc9e8 100644
--- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
@@ -156,13 +156,13 @@ class ObjectTreeTest extends \Test\TestCase {
$_SERVER['HTTP_OC_CHUNKED'] = true;
}
- $rootNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $rootNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager')
->disableOriginalConstructor()
->getMock();
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
$fileInfo = $this->getMockBuilder('\OCP\Files\FileInfo')
@@ -275,7 +275,7 @@ class ObjectTreeTest extends \Test\TestCase {
$storage = new Temporary([]);
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['resolvePath'])
->getMock();
$view->expects($this->once())
@@ -284,7 +284,7 @@ class ObjectTreeTest extends \Test\TestCase {
return [$storage, ltrim($path, '/')];
}));
- $rootNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $rootNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager')
@@ -302,7 +302,7 @@ class ObjectTreeTest extends \Test\TestCase {
$storage = new Temporary([]);
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['resolvePath'])
->getMock();
$view->expects($this->any())
@@ -311,7 +311,7 @@ class ObjectTreeTest extends \Test\TestCase {
return [$storage, ltrim($path, '/')];
}));
- $rootNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $rootNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager')
diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php
index 3f3bf16a422..ec4652a3af2 100644
--- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php
@@ -24,6 +24,8 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
+use OCP\IConfig;
+
/**
* Class PartFileInRootUploadTest
*
@@ -34,7 +36,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
class PartFileInRootUploadTest extends UploadTest {
protected function setUp() {
$config = \OC::$server->getConfig();
- $mockConfig = $this->getMockBuilder('\OCP\IConfig')
+ $mockConfig = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$mockConfig->expects($this->any())
diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php
index 58a729e18ec..aec467dd50a 100644
--- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php
+++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php
@@ -29,6 +29,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
use OCA\DAV\Connector\Sabre\Server;
use OCA\DAV\Connector\Sabre\ServerFactory;
use OC\Files\View;
+use OCP\IRequest;
use Sabre\HTTP\Request;
use Test\TestCase;
use Test\Traits\MountProviderTrait;
@@ -62,7 +63,7 @@ abstract class RequestTestCase extends TestCase {
\OC::$server->getUserSession(),
\OC::$server->getMountManager(),
\OC::$server->getTagManager(),
- $this->getMockBuilder('\OCP\IRequest')
+ $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock(),
\OC::$server->getPreviewManager()
diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
index 2b4a886050a..7c735ca2334 100644
--- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
@@ -23,6 +23,14 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Connector\Sabre\File;
+use OCP\Files\Folder;
+use OCP\IUser;
+use OCP\IUserSession;
+use OCP\Share\IManager;
+use Sabre\DAV\Tree;
+
class SharesPluginTest extends \Test\TestCase {
const SHARETYPES_PROPERTYNAME = \OCA\DAV\Connector\Sabre\SharesPlugin::SHARETYPES_PROPERTYNAME;
@@ -55,26 +63,26 @@ class SharesPluginTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
$this->server = new \Sabre\DAV\Server();
- $this->tree = $this->getMockBuilder('\Sabre\DAV\Tree')
+ $this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
->getMock();
- $this->shareManager = $this->getMockBuilder('\OCP\Share\IManager')
+ $this->shareManager = $this->getMockBuilder(IManager::class)
->disableOriginalConstructor()
->getMock();
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->once())
->method('getUID')
->will($this->returnValue('user1'));
- $userSession = $this->getMockBuilder('\OCP\IUserSession')
+ $userSession = $this->getMockBuilder(IUserSession::class)
->disableOriginalConstructor()
->getMock();
$userSession->expects($this->once())
->method('getUser')
->will($this->returnValue($user));
- $this->userFolder = $this->getMockBuilder('\OCP\Files\Folder')
+ $this->userFolder = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
@@ -102,7 +110,7 @@ class SharesPluginTest extends \Test\TestCase {
->will($this->returnValue('/subdir'));
// node API nodes
- $node = $this->getMockBuilder('\OCP\Files\Folder')
+ $node = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
@@ -149,7 +157,7 @@ class SharesPluginTest extends \Test\TestCase {
* @dataProvider sharesGetPropertiesDataProvider
*/
public function testPreloadThenGetProperties($shareTypes) {
- $sabreNode1 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $sabreNode1 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$sabreNode1->expects($this->any())
@@ -157,7 +165,7 @@ class SharesPluginTest extends \Test\TestCase {
->will($this->returnValue(111));
$sabreNode1->expects($this->any())
->method('getPath');
- $sabreNode2 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $sabreNode2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$sabreNode2->expects($this->any())
@@ -167,7 +175,7 @@ class SharesPluginTest extends \Test\TestCase {
->method('getPath')
->will($this->returnValue('/subdir/foo'));
- $sabreNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $sabreNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$sabreNode->expects($this->any())
@@ -181,19 +189,19 @@ class SharesPluginTest extends \Test\TestCase {
->will($this->returnValue('/subdir'));
// node API nodes
- $node = $this->getMockBuilder('\OCP\Files\Folder')
+ $node = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
->method('getId')
->will($this->returnValue(123));
- $node1 = $this->getMockBuilder('\OCP\Files\File')
+ $node1 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node1->expects($this->any())
->method('getId')
->will($this->returnValue(111));
- $node2 = $this->getMockBuilder('\OCP\Files\File')
+ $node2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node2->expects($this->any())
diff --git a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
index 9189a73f77f..48d02cad690 100644
--- a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
@@ -24,6 +24,10 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Connector\Sabre\File;
+use Sabre\DAV\Tree;
+
/**
* Copyright (c) 2014 Vincent Petry <pvince81@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
@@ -42,7 +46,7 @@ class TagsPluginTest extends \Test\TestCase {
private $server;
/**
- * @var \Sabre\DAV\Tree
+ * @var Tree
*/
private $tree;
@@ -64,7 +68,7 @@ class TagsPluginTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
$this->server = new \Sabre\DAV\Server();
- $this->tree = $this->getMockBuilder('\Sabre\DAV\Tree')
+ $this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
->getMock();
$this->tagger = $this->getMockBuilder('\OCP\ITags')
@@ -124,13 +128,13 @@ class TagsPluginTest extends \Test\TestCase {
* @dataProvider tagsGetPropertiesDataProvider
*/
public function testPreloadThenGetProperties($tags, $requestedProperties, $expectedProperties) {
- $node1 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $node1 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node1->expects($this->any())
->method('getId')
->will($this->returnValue(111));
- $node2 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $node2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node2->expects($this->any())
@@ -145,7 +149,7 @@ class TagsPluginTest extends \Test\TestCase {
$expectedCallCount = 1;
}
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $node = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
diff --git a/apps/dav/tests/unit/DAV/Sharing/PluginTest.php b/apps/dav/tests/unit/DAV/Sharing/PluginTest.php
index c4dae96e52f..1a9015c6cbb 100644
--- a/apps/dav/tests/unit/DAV/Sharing/PluginTest.php
+++ b/apps/dav/tests/unit/DAV/Sharing/PluginTest.php
@@ -51,7 +51,7 @@ class PluginTest extends TestCase {
$authBackend->method('isDavAuthenticated')->willReturn(true);
/** @var IRequest $request */
- $request = $this->getMockBuilder('OCP\IRequest')->disableOriginalConstructor()->getMock();
+ $request = $this->getMockBuilder(IRequest::class)->disableOriginalConstructor()->getMock();
$this->plugin = new Plugin($authBackend, $request);
$root = new SimpleCollection('root');
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
index 1831210546d..ac4e9016434 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
@@ -25,6 +25,7 @@
namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag;
+use OCP\IUser;
use OCP\SystemTag\TagNotFoundException;
use OCP\SystemTag\ISystemTag;
@@ -52,7 +53,7 @@ class SystemTagMappingNodeTest extends \Test\TestCase {
->getMock();
$this->tagMapper = $this->getMockBuilder('\OCP\SystemTag\ISystemTagObjectMapper')
->getMock();
- $this->user = $this->getMockBuilder('\OCP\IUser')
+ $this->user = $this->getMockBuilder(IUser::class)
->getMock();
}
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
index 3722bd9d25a..e50c3d30758 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
@@ -26,6 +26,7 @@ namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag;
+use OCP\IUser;
use OCP\SystemTag\TagNotFoundException;
use OCP\SystemTag\TagAlreadyExistsException;
use OCP\SystemTag\ISystemTag;
@@ -48,7 +49,7 @@ class SystemTagNodeTest extends \Test\TestCase {
$this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager')
->getMock();
- $this->user = $this->getMockBuilder('\OCP\IUser')
+ $this->user = $this->getMockBuilder(IUser::class)
->getMock();
}
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
index fcfa528ac64..f1c18cf45a3 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
@@ -32,6 +32,9 @@ use OCP\IUserSession;
use OCP\SystemTag\TagAlreadyExistsException;
use OCP\IUser;
use OCP\SystemTag\ISystemTag;
+use Sabre\DAV\Tree;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
class SystemTagPluginTest extends \Test\TestCase {
@@ -79,7 +82,7 @@ class SystemTagPluginTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->tree = $this->getMockBuilder('\Sabre\DAV\Tree')
+ $this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
->getMock();
@@ -87,11 +90,11 @@ class SystemTagPluginTest extends \Test\TestCase {
$this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager')
->getMock();
- $this->groupManager = $this->getMockBuilder('\OCP\IGroupManager')
+ $this->groupManager = $this->getMockBuilder(IGroupManager::class)
->getMock();
- $this->user = $this->getMockBuilder('\OCP\IUser')
+ $this->user = $this->getMockBuilder(IUser::class)
->getMock();
- $this->userSession = $this->getMockBuilder('\OCP\IUserSession')
+ $this->userSession = $this->getMockBuilder(IUserSession::class)
->getMock();
$this->userSession
->expects($this->any())
@@ -413,10 +416,10 @@ class SystemTagPluginTest extends \Test\TestCase {
->with('/systemtags')
->will($this->returnValue($node));
- $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();
@@ -458,10 +461,10 @@ class SystemTagPluginTest extends \Test\TestCase {
->with('/systemtags')
->will($this->returnValue($node));
- $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();
@@ -545,10 +548,10 @@ class SystemTagPluginTest extends \Test\TestCase {
->with('/systemtags')
->will($this->returnValue($node));
- $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();
@@ -619,10 +622,10 @@ class SystemTagPluginTest extends \Test\TestCase {
->method('createFile')
->with(1);
- $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();
@@ -668,10 +671,10 @@ class SystemTagPluginTest extends \Test\TestCase {
$node->expects($this->never())
->method('createFile');
- $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();
@@ -715,10 +718,10 @@ class SystemTagPluginTest extends \Test\TestCase {
->with('/systemtags')
->will($this->returnValue($node));
- $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/SystemTag/SystemTagsByIdCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
index 73431393071..53f54e19f0a 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
@@ -26,6 +26,9 @@ namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag;
+use OCP\IGroupManager;
+use OCP\IUser;
+use OCP\IUserSession;
use OCP\SystemTag\TagNotFoundException;
class SystemTagsByIdCollectionTest extends \Test\TestCase {
@@ -48,17 +51,17 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
}
public function getNode($isAdmin = true) {
- $this->user = $this->getMockBuilder('\OCP\IUser')
+ $this->user = $this->getMockBuilder(IUser::class)
->getMock();
$this->user->expects($this->any())
->method('getUID')
->will($this->returnValue('testuser'));
- $userSession = $this->getMockBuilder('\OCP\IUserSession')
+ $userSession = $this->getMockBuilder(IUserSession::class)
->getMock();
$userSession->expects($this->any())
->method('getUser')
->will($this->returnValue($this->user));
- $groupManager = $this->getMockBuilder('\OCP\IGroupManager')
+ $groupManager = $this->getMockBuilder(IGroupManager::class)
->getMock();
$groupManager->expects($this->any())
->method('isAdmin')
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
index 9aa35c2ab24..61f94c9e60b 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
@@ -26,6 +26,7 @@ namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag;
+use OCP\IUser;
use OCP\SystemTag\TagNotFoundException;
class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
@@ -53,7 +54,7 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
$this->tagMapper = $this->getMockBuilder('\OCP\SystemTag\ISystemTagObjectMapper')
->getMock();
- $this->user = $this->getMockBuilder('\OCP\IUser')
+ $this->user = $this->getMockBuilder(IUser::class)
->getMock();
}
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
index 0c065d3451a..e3de7db1584 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
@@ -24,6 +24,11 @@
namespace OCA\DAV\Tests\unit\SystemTag;
+use OCP\Files\Folder;
+use OCP\IGroupManager;
+use OCP\IUser;
+use OCP\IUserSession;
+
class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
/**
@@ -54,24 +59,24 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
$this->tagMapper = $this->getMockBuilder('\OCP\SystemTag\ISystemTagObjectMapper')
->getMock();
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->getMock();
$user->expects($this->any())
->method('getUID')
->will($this->returnValue('testuser'));
- $userSession = $this->getMockBuilder('\OCP\IUserSession')
+ $userSession = $this->getMockBuilder(IUserSession::class)
->getMock();
$userSession->expects($this->any())
->method('getUser')
->will($this->returnValue($user));
- $groupManager = $this->getMockBuilder('\OCP\IGroupManager')
+ $groupManager = $this->getMockBuilder(IGroupManager::class)
->getMock();
$groupManager->expects($this->any())
->method('isAdmin')
->with('testuser')
->will($this->returnValue(true));
- $this->userFolder = $this->getMockBuilder('\OCP\Files\Folder')
+ $this->userFolder = $this->getMockBuilder(Folder::class)
->getMock();
$userFolder = $this->userFolder;
diff --git a/apps/encryption/tests/Command/TestEnableMasterKey.php b/apps/encryption/tests/Command/TestEnableMasterKey.php
index 75d5fa3d5e7..dac26c5d3c7 100644
--- a/apps/encryption/tests/Command/TestEnableMasterKey.php
+++ b/apps/encryption/tests/Command/TestEnableMasterKey.php
@@ -27,6 +27,7 @@ namespace OCA\Encryption\Tests\Command;
use OCA\Encryption\Command\EnableMasterKey;
use OCA\Encryption\Util;
+use OCP\IConfig;
use Test\TestCase;
class TestEnableMasterKey extends TestCase {
@@ -54,7 +55,7 @@ class TestEnableMasterKey extends TestCase {
$this->util = $this->getMockBuilder('OCA\Encryption\Util')
->disableOriginalConstructor()->getMock();
- $this->config = $this->getMockBuilder('OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()->getMock();
$this->questionHelper = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
->disableOriginalConstructor()->getMock();
diff --git a/apps/encryption/tests/Controller/RecoveryControllerTest.php b/apps/encryption/tests/Controller/RecoveryControllerTest.php
index fd1b0663b49..384cce94c42 100644
--- a/apps/encryption/tests/Controller/RecoveryControllerTest.php
+++ b/apps/encryption/tests/Controller/RecoveryControllerTest.php
@@ -27,6 +27,9 @@ namespace OCA\Encryption\Tests\Controller;
use OCA\Encryption\Controller\RecoveryController;
use OCP\AppFramework\Http;
+use OCP\IConfig;
+use OCP\IL10N;
+use OCP\IRequest;
use Test\TestCase;
class RecoveryControllerTest extends TestCase {
@@ -151,15 +154,15 @@ class RecoveryControllerTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->requestMock = $this->getMockBuilder('OCP\IRequest')
+ $this->requestMock = $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock();
- $this->configMock = $this->getMockBuilder('OCP\IConfig')
+ $this->configMock = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->l10nMock = $this->getMockBuilder('OCP\IL10N')
+ $this->l10nMock = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/encryption/tests/Controller/SettingsControllerTest.php b/apps/encryption/tests/Controller/SettingsControllerTest.php
index 4f3e09687e3..fcff78d77de 100644
--- a/apps/encryption/tests/Controller/SettingsControllerTest.php
+++ b/apps/encryption/tests/Controller/SettingsControllerTest.php
@@ -26,7 +26,9 @@ namespace OCA\Encryption\Tests\Controller;
use OCA\Encryption\Controller\SettingsController;
use OCA\Encryption\Session;
use OCP\AppFramework\Http;
+use OCP\IL10N;
use OCP\IRequest;
+use OCP\IUserManager;
use Test\TestCase;
class SettingsControllerTest extends TestCase {
@@ -67,7 +69,7 @@ class SettingsControllerTest extends TestCase {
$this->requestMock = $this->createMock(IRequest::class);
- $this->l10nMock = $this->getMockBuilder('OCP\IL10N')
+ $this->l10nMock = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()->getMock();
$this->l10nMock->expects($this->any())
@@ -76,7 +78,7 @@ class SettingsControllerTest extends TestCase {
return $message;
}));
- $this->userManagerMock = $this->getMockBuilder('OCP\IUserManager')
+ $this->userManagerMock = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()->getMock();
$this->keyManagerMock = $this->getMockBuilder('OCA\Encryption\KeyManager')
diff --git a/apps/encryption/tests/Controller/StatusControllerTest.php b/apps/encryption/tests/Controller/StatusControllerTest.php
index ee0f7b2661c..cd3a8fdaa72 100644
--- a/apps/encryption/tests/Controller/StatusControllerTest.php
+++ b/apps/encryption/tests/Controller/StatusControllerTest.php
@@ -28,6 +28,7 @@ namespace OCA\Encryption\Tests\Controller;
use OCA\Encryption\Controller\StatusController;
use OCA\Encryption\Session;
use OCP\Encryption\IManager;
+use OCP\IL10N;
use OCP\IRequest;
use Test\TestCase;
@@ -56,7 +57,7 @@ class StatusControllerTest extends TestCase {
->disableOriginalConstructor()->getMock();
$this->requestMock = $this->createMock(IRequest::class);
- $this->l10nMock = $this->getMockBuilder('OCP\IL10N')
+ $this->l10nMock = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()->getMock();
$this->l10nMock->expects($this->any())
->method('t')
diff --git a/apps/encryption/tests/Crypto/CryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php
index 3c226ed94ab..4800be0a5ed 100644
--- a/apps/encryption/tests/Crypto/CryptTest.php
+++ b/apps/encryption/tests/Crypto/CryptTest.php
@@ -27,7 +27,9 @@ namespace OCA\Encryption\Tests\Crypto;
use OCA\Encryption\Crypto\Crypt;
+use OCP\IConfig;
use OCP\IL10N;
+use OCP\ILogger;
use Test\TestCase;
class CryptTest extends TestCase {
@@ -51,7 +53,7 @@ class CryptTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->logger = $this->getMockBuilder('OCP\ILogger')
+ $this->logger = $this->getMockBuilder(ILogger::class)
->disableOriginalConstructor()
->getMock();
$this->logger->expects($this->any())
@@ -60,7 +62,7 @@ class CryptTest extends TestCase {
$this->userSession = $this->getMockBuilder('OCP\IUserSession')
->disableOriginalConstructor()
->getMock();
- $this->config = $this->getMockBuilder('OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$this->l = $this->createMock(IL10N::class);
diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php
index df8401c15b2..7d432a6d524 100644
--- a/apps/encryption/tests/Crypto/EncryptAllTest.php
+++ b/apps/encryption/tests/Crypto/EncryptAllTest.php
@@ -26,6 +26,11 @@ namespace OCA\Encryption\Tests\Crypto;
use OCA\Encryption\Crypto\EncryptAll;
+use OCP\IConfig;
+use OCP\IL10N;
+use OCP\IUserManager;
+use OCP\Mail\IMailer;
+use OCP\UserInterface;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Test\TestCase;
@@ -81,15 +86,15 @@ class EncryptAllTest extends TestCase {
->disableOriginalConstructor()->getMock();
$this->util = $this->getMockBuilder('OCA\Encryption\Util')
->disableOriginalConstructor()->getMock();
- $this->userManager = $this->getMockBuilder('OCP\IUserManager')
+ $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()->getMock();
$this->view = $this->getMockBuilder('OC\Files\View')
->disableOriginalConstructor()->getMock();
- $this->config = $this->getMockBuilder('OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()->getMock();
- $this->mailer = $this->getMockBuilder('OCP\Mail\IMailer')
+ $this->mailer = $this->getMockBuilder(IMailer::class)
->disableOriginalConstructor()->getMock();
- $this->l = $this->getMockBuilder('OCP\IL10N')
+ $this->l = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()->getMock();
$this->questionHelper = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
->disableOriginalConstructor()->getMock();
@@ -97,7 +102,7 @@ class EncryptAllTest extends TestCase {
->disableOriginalConstructor()->getMock();
$this->outputInterface = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')
->disableOriginalConstructor()->getMock();
- $this->userInterface = $this->getMockBuilder('OCP\UserInterface')
+ $this->userInterface = $this->getMockBuilder(UserInterface::class)
->disableOriginalConstructor()->getMock();
diff --git a/apps/encryption/tests/Crypto/EncryptionTest.php b/apps/encryption/tests/Crypto/EncryptionTest.php
index 7e074a5b9e8..3bd4593d6bc 100644
--- a/apps/encryption/tests/Crypto/EncryptionTest.php
+++ b/apps/encryption/tests/Crypto/EncryptionTest.php
@@ -24,6 +24,8 @@
namespace OCA\Encryption\Tests\Crypto;
use OCA\Encryption\Exceptions\PublicKeyMissingException;
+use OCP\IL10N;
+use OCP\ILogger;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
@@ -84,10 +86,10 @@ class EncryptionTest extends TestCase {
$this->decryptAllMock = $this->getMockBuilder('OCA\Encryption\Crypto\DecryptAll')
->disableOriginalConstructor()
->getMock();
- $this->loggerMock = $this->getMockBuilder('OCP\ILogger')
+ $this->loggerMock = $this->getMockBuilder(ILogger::class)
->disableOriginalConstructor()
->getMock();
- $this->l10nMock = $this->getMockBuilder('OCP\IL10N')
+ $this->l10nMock = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()
->getMock();
$this->l10nMock->expects($this->any())
diff --git a/apps/encryption/tests/Hooks/UserHooksTest.php b/apps/encryption/tests/Hooks/UserHooksTest.php
index f9477e3e038..506f46eb8e6 100644
--- a/apps/encryption/tests/Hooks/UserHooksTest.php
+++ b/apps/encryption/tests/Hooks/UserHooksTest.php
@@ -31,6 +31,7 @@ use OCA\Encryption\Crypto\Crypt;
use OCA\Encryption\Hooks\UserHooks;
use OCP\ILogger;
use OCP\IUser;
+use OCP\IUserManager;
use Test\TestCase;
/**
@@ -327,7 +328,7 @@ class UserHooksTest extends TestCase {
$this->keyManagerMock = $this->getMockBuilder('OCA\Encryption\KeyManager')
->disableOriginalConstructor()
->getMock();
- $this->userManagerMock = $this->getMockBuilder('OCP\IUserManager')
+ $this->userManagerMock = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()
->getMock();
$this->userSetupMock = $this->getMockBuilder('OCA\Encryption\Users\Setup')
diff --git a/apps/encryption/tests/MigrationTest.php b/apps/encryption/tests/MigrationTest.php
index 8f168e31e4d..71d2f52dd5c 100644
--- a/apps/encryption/tests/MigrationTest.php
+++ b/apps/encryption/tests/MigrationTest.php
@@ -25,6 +25,7 @@
namespace OCA\Encryption\Tests;
+use OC\Files\View;
use OCA\Encryption\Migration;
use OCP\ILogger;
@@ -68,7 +69,7 @@ class MigrationTest extends \Test\TestCase {
public function setUp() {
- $this->logger = $this->getMockBuilder('\OCP\ILogger')->disableOriginalConstructor()->getMock();
+ $this->logger = $this->getMockBuilder(ILogger::class)->disableOriginalConstructor()->getMock();
$this->view = new \OC\Files\View();
$this->moduleId = \OCA\Encryption\Crypto\Encryption::ID;
}
@@ -524,7 +525,7 @@ class MigrationTest extends \Test\TestCase {
*/
public function testGetTargetDir($user, $keyPath, $filename, $trash, $systemMounts, $expected) {
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()->getMock();
$view->expects($this->any())->method('file_exists')->willReturn(true);
diff --git a/apps/encryption/tests/Settings/AdminTest.php b/apps/encryption/tests/Settings/AdminTest.php
index 93896585dad..5fe3fe956e4 100644
--- a/apps/encryption/tests/Settings/AdminTest.php
+++ b/apps/encryption/tests/Settings/AdminTest.php
@@ -52,12 +52,12 @@ class AdminTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->l = $this->getMockBuilder('\OCP\IL10N')->getMock();
- $this->logger = $this->getMockBuilder('\OCP\ILogger')->getMock();
- $this->userSession = $this->getMockBuilder('\OCP\IUserSession')->getMock();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
- $this->userManager = $this->getMockBuilder('\OCP\IUserManager')->getMock();
- $this->session = $this->getMockBuilder('\OCP\ISession')->getMock();
+ $this->l = $this->getMockBuilder(IL10N::class)->getMock();
+ $this->logger = $this->getMockBuilder(ILogger::class)->getMock();
+ $this->userSession = $this->getMockBuilder(IUserSession::class)->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
+ $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
+ $this->session = $this->getMockBuilder(ISession::class)->getMock();
$this->admin = new Admin(
$this->l,
diff --git a/apps/federatedfilesharing/tests/AddressHandlerTest.php b/apps/federatedfilesharing/tests/AddressHandlerTest.php
index 6d215d40156..a9c5cedf49b 100644
--- a/apps/federatedfilesharing/tests/AddressHandlerTest.php
+++ b/apps/federatedfilesharing/tests/AddressHandlerTest.php
@@ -47,9 +47,9 @@ class AddressHandlerTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->urlGenerator = $this->getMockBuilder('OCP\IURLGenerator')
+ $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)
->getMock();
- $this->il10n = $this->getMockBuilder('OCP\IL10N')
+ $this->il10n = $this->getMockBuilder(IL10N::class)
->getMock();
$this->cloudIdManager = new CloudIdManager();
diff --git a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php
index 7714ff4731c..b5ea08af8d5 100644
--- a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php
+++ b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php
@@ -35,6 +35,7 @@ use OCP\Federation\ICloudIdManager;
use OCP\Files\IRootFolder;
use OCP\Http\Client\IClientService;
use OCP\IL10N;
+use OCP\IRequest;
use OCP\ISession;
use OCP\IUserManager;
use OCP\IUserSession;
@@ -85,17 +86,17 @@ class MountPublicLinkControllerTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->request = $this->getMockBuilder('OCP\IRequest')->disableOriginalConstructor()->getMock();
+ $this->request = $this->getMockBuilder(IRequest::class)->disableOriginalConstructor()->getMock();
$this->federatedShareProvider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider')
->disableOriginalConstructor()->getMock();
$this->shareManager = $this->getMockBuilder('OCP\Share\IManager')->disableOriginalConstructor()->getMock();
$this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler')
->disableOriginalConstructor()->getMock();
$this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->disableOriginalConstructor()->getMock();
- $this->userManager = $this->getMockBuilder('OCP\IUserManager')->disableOriginalConstructor()->getMock();
+ $this->userManager = $this->getMockBuilder(IUserManager::class)->disableOriginalConstructor()->getMock();
$this->share = new \OC\Share20\Share($this->rootFolder, $this->userManager);
$this->session = $this->getMockBuilder('OCP\ISession')->disableOriginalConstructor()->getMock();
- $this->l10n = $this->getMockBuilder('OCP\IL10N')->disableOriginalConstructor()->getMock();
+ $this->l10n = $this->getMockBuilder(IL10N::class)->disableOriginalConstructor()->getMock();
$this->userSession = $this->getMockBuilder('OCP\IUserSession')->disableOriginalConstructor()->getMock();
$this->clientService = $this->getMockBuilder('OCP\Http\Client\IClientService')->disableOriginalConstructor()->getMock();
$this->cloudIdManager = new CloudIdManager();
diff --git a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
index d57b2cb207f..538c6ae5a08 100644
--- a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
+++ b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
@@ -29,13 +29,13 @@ namespace OCA\FederatedFileSharing\Tests;
use OC\Federation\CloudIdManager;
use OC\Files\Filesystem;
-use OCA\FederatedFileSharing\DiscoveryManager;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\FederatedFileSharing\Controller\RequestHandlerController;
use OCP\Federation\ICloudIdManager;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
+use OCP\IConfig;
use OCP\IUserManager;
use OCP\Share\IShare;
@@ -83,9 +83,9 @@ class RequestHandlerControllerTest extends TestCase {
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
\OC\Share\Share::registerBackend('test', 'Test\Share\Backend');
- $config = $this->getMockBuilder('\OCP\IConfig')
+ $config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()->getMock();
- $clientService = $this->getMockBuilder('\OCP\Http\Client\IClientService')->getMock();
+ $clientService = $this->getMockBuilder(IClientService::class)->getMock();
$httpHelperMock = $this->getMockBuilder('\OC\HTTPHelper')
->setConstructorArgs([$config, $clientService])
->getMock();
@@ -104,7 +104,7 @@ class RequestHandlerControllerTest extends TestCase {
->disableOriginalConstructor()->getMock();
$this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler')
->disableOriginalConstructor()->getMock();
- $this->userManager = $this->getMockBuilder('OCP\IUserManager')->getMock();
+ $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
$this->cloudIdManager = new CloudIdManager();
diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
index 3ecd8162cad..aa81eef9e63 100644
--- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
+++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php
@@ -31,6 +31,7 @@ use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\FederatedFileSharing\Notifications;
use OCA\FederatedFileSharing\TokenHandler;
use OCP\Federation\ICloudIdManager;
+use OCP\Files\File;
use OCP\Files\IRootFolder;
use OCP\IConfig;
use OCP\IDBConnection;
@@ -87,15 +88,15 @@ class FederatedShareProviderTest extends \Test\TestCase {
$this->tokenHandler = $this->getMockBuilder('OCA\FederatedFileSharing\TokenHandler')
->disableOriginalConstructor()
->getMock();
- $this->l = $this->getMockBuilder('OCP\IL10N')->getMock();
+ $this->l = $this->getMockBuilder(IL10N::class)->getMock();
$this->l->method('t')
->will($this->returnCallback(function($text, $parameters = []) {
return vsprintf($text, $parameters);
}));
- $this->logger = $this->getMockBuilder('OCP\ILogger')->getMock();
+ $this->logger = $this->getMockBuilder(ILogger::class)->getMock();
$this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->getMock();
- $this->config = $this->getMockBuilder('OCP\IConfig')->getMock();
- $this->userManager = $this->getMockBuilder('OCP\IUserManager')->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
+ $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
//$this->addressHandler = new AddressHandler(\OC::$server->getURLGenerator(), $this->l);
$this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler')->disableOriginalConstructor()->getMock();
$this->cloudIdManager = new CloudIdManager();
@@ -129,7 +130,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
public function testCreate() {
$share = $this->shareManager->newShare();
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -200,7 +201,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
public function testCreateCouldNotFindServer() {
$share = $this->shareManager->newShare();
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -256,7 +257,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
public function testCreateException() {
$share = $this->shareManager->newShare();
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -312,7 +313,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
public function testCreateShareWithSelf() {
$share = $this->shareManager->newShare();
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -351,7 +352,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
public function testCreateAlreadyShared() {
$share = $this->shareManager->newShare();
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -419,7 +420,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
$share = $this->shareManager->newShare();
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -476,7 +477,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
}
public function testGetSharedBy() {
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -517,7 +518,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
}
public function testGetSharedByWithNode() {
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -536,7 +537,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
->setNode($node);
$this->provider->create($share);
- $node2 = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node2 = $this->getMockBuilder(File::class)->getMock();
$node2->method('getId')->willReturn(43);
$node2->method('getName')->willReturn('myOtherFile');
@@ -555,7 +556,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
}
public function testGetSharedByWithReshares() {
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
@@ -588,7 +589,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
}
public function testGetSharedByWithLimit() {
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$node->method('getId')->willReturn(42);
$node->method('getName')->willReturn('myFile');
diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php
index 007335b948d..3d8c8164abb 100644
--- a/apps/files/tests/Controller/ViewControllerTest.php
+++ b/apps/files/tests/Controller/ViewControllerTest.php
@@ -27,6 +27,8 @@ namespace OCA\Files\Tests\Controller;
use OCA\Files\Controller\ViewController;
use OCP\AppFramework\Http;
+use OCP\Files\File;
+use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\IUser;
use OCP\Template;
@@ -68,14 +70,14 @@ class ViewControllerTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->request = $this->getMockBuilder('\OCP\IRequest')->getMock();
- $this->urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')->getMock();
- $this->l10n = $this->getMockBuilder('\OCP\IL10N')->getMock();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
+ $this->request = $this->getMockBuilder(IRequest::class)->getMock();
+ $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock();
+ $this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->eventDispatcher = $this->getMockBuilder('\Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
- $this->userSession = $this->getMockBuilder('\OCP\IUserSession')->getMock();
+ $this->userSession = $this->getMockBuilder(IUserSession::class)->getMock();
$this->appManager = $this->getMockBuilder('\OCP\App\IAppManager')->getMock();
- $this->user = $this->getMockBuilder('\OCP\IUser')->getMock();
+ $this->user = $this->getMockBuilder(IUser::class)->getMock();
$this->user->expects($this->any())
->method('getUID')
->will($this->returnValue('testuser1'));
@@ -281,12 +283,12 @@ class ViewControllerTest extends TestCase {
}
public function testShowFileRouteWithFolder() {
- $node = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $node = $this->getMockBuilder(Folder::class)->getMock();
$node->expects($this->once())
->method('getPath')
->will($this->returnValue('/testuser1/files/test/sub'));
- $baseFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $baseFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
->method('getUserFolder')
@@ -313,19 +315,19 @@ class ViewControllerTest extends TestCase {
}
public function testShowFileRouteWithFile() {
- $parentNode = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $parentNode = $this->getMockBuilder(Folder::class)->getMock();
$parentNode->expects($this->once())
->method('getPath')
->will($this->returnValue('testuser1/files/test'));
- $baseFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $baseFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
->method('getUserFolder')
->with('testuser1')
->will($this->returnValue($baseFolder));
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$node->expects($this->once())
->method('getParent')
->will($this->returnValue($parentNode));
@@ -353,7 +355,7 @@ class ViewControllerTest extends TestCase {
}
public function testShowFileRouteWithInvalidFileId() {
- $baseFolder = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $baseFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->once())
->method('getUserFolder')
->with('testuser1')
@@ -380,13 +382,13 @@ class ViewControllerTest extends TestCase {
->with('files_trashbin')
->will($this->returnValue(true));
- $parentNode = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $parentNode = $this->getMockBuilder(Folder::class)->getMock();
$parentNode->expects($this->once())
->method('getPath')
->will($this->returnValue('testuser1/files_trashbin/files/test.d1462861890/sub'));
- $baseFolderFiles = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
- $baseFolderTrash = $this->getMockBuilder('\OCP\Files\Folder')->getMock();
+ $baseFolderFiles = $this->getMockBuilder(Folder::class)->getMock();
+ $baseFolderTrash = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->at(0))
->method('getUserFolder')
@@ -402,7 +404,7 @@ class ViewControllerTest extends TestCase {
->with(123)
->will($this->returnValue([]));
- $node = $this->getMockBuilder('\OCP\Files\File')->getMock();
+ $node = $this->getMockBuilder(File::class)->getMock();
$node->expects($this->once())
->method('getParent')
->will($this->returnValue($parentNode));
diff --git a/apps/files/tests/Settings/AdminTest.php b/apps/files/tests/Settings/AdminTest.php
index 1ab8a992879..1bcfd111db5 100644
--- a/apps/files/tests/Settings/AdminTest.php
+++ b/apps/files/tests/Settings/AdminTest.php
@@ -41,7 +41,7 @@ class AdminTest extends TestCase {
public function setUp() {
parent::setUp();
$this->iniGetWrapper = $this->getMockBuilder('\bantu\IniGetWrapper\IniGetWrapper')->disableOriginalConstructor()->getMock();
- $this->request = $this->getMockBuilder('\OCP\IRequest')->getMock();
+ $this->request = $this->getMockBuilder(IRequest::class)->getMock();
$this->admin = new Admin(
$this->iniGetWrapper,
$this->request
diff --git a/apps/files_external/tests/Auth/AuthMechanismTest.php b/apps/files_external/tests/Auth/AuthMechanismTest.php
index 5d635a5036a..11eee7b8824 100644
--- a/apps/files_external/tests/Auth/AuthMechanismTest.php
+++ b/apps/files_external/tests/Auth/AuthMechanismTest.php
@@ -22,10 +22,14 @@
namespace OCA\Files_External\Tests\Auth;
+use OCA\Files_External\Lib\Auth\AuthMechanism;
+use OCA\Files_External\Lib\Backend\Backend;
+use OCA\Files_External\Lib\StorageConfig;
+
class AuthMechanismTest extends \Test\TestCase {
public function testJsonSerialization() {
- $mechanism = $this->getMockBuilder('\OCA\Files_External\Lib\Auth\AuthMechanism')
+ $mechanism = $this->getMockBuilder(AuthMechanism::class)
->setMethods(['jsonSerializeDefinition'])
->getMock();
$mechanism->expects($this->once())
@@ -52,7 +56,7 @@ class AuthMechanismTest extends \Test\TestCase {
* @dataProvider validateStorageProvider
*/
public function testValidateStorage($expectedSuccess, $scheme, $definitionSuccess) {
- $mechanism = $this->getMockBuilder('\OCA\Files_External\Lib\Auth\AuthMechanism')
+ $mechanism = $this->getMockBuilder(AuthMechanism::class)
->setMethods(['validateStorageDefinition'])
->getMock();
$mechanism->expects($this->atMost(1))
@@ -61,14 +65,14 @@ class AuthMechanismTest extends \Test\TestCase {
$mechanism->setScheme($scheme);
- $backend = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
+ $backend = $this->getMockBuilder(Backend::class)
->disableOriginalConstructor()
->getMock();
$backend->expects($this->once())
->method('getAuthSchemes')
->willReturn(['scheme' => true, 'foobar' => true]);
- $storageConfig = $this->getMockBuilder('\OCA\Files_External\Lib\StorageConfig')
+ $storageConfig = $this->getMockBuilder(StorageConfig::class)
->disableOriginalConstructor()
->getMock();
$storageConfig->expects($this->once())
diff --git a/apps/files_external/tests/Backend/BackendTest.php b/apps/files_external/tests/Backend/BackendTest.php
index 762b9f4c0e8..1a1c386240a 100644
--- a/apps/files_external/tests/Backend/BackendTest.php
+++ b/apps/files_external/tests/Backend/BackendTest.php
@@ -23,11 +23,12 @@
namespace OCA\Files_External\Tests\Backend;
use \OCA\Files_External\Lib\Backend\Backend;
+use OCA\Files_External\Lib\StorageConfig;
class BackendTest extends \Test\TestCase {
public function testJsonSerialization() {
- $backend = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
+ $backend = $this->getMockBuilder(Backend::class)
->setMethods(['jsonSerializeDefinition'])
->getMock();
$backend->expects($this->once())
@@ -59,14 +60,14 @@ class BackendTest extends \Test\TestCase {
* @dataProvider validateStorageProvider
*/
public function testValidateStorage($expectedSuccess, $definitionSuccess) {
- $backend = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
+ $backend = $this->getMockBuilder(Backend::class)
->setMethods(['validateStorageDefinition'])
->getMock();
$backend->expects($this->atMost(1))
->method('validateStorageDefinition')
->willReturn($definitionSuccess);
- $storageConfig = $this->getMockBuilder('\OCA\Files_External\Lib\StorageConfig')
+ $storageConfig = $this->getMockBuilder(StorageConfig::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/files_external/tests/Controller/StoragesControllerTest.php b/apps/files_external/tests/Controller/StoragesControllerTest.php
index 35a055e6be5..f854b25676c 100644
--- a/apps/files_external/tests/Controller/StoragesControllerTest.php
+++ b/apps/files_external/tests/Controller/StoragesControllerTest.php
@@ -23,6 +23,8 @@
*/
namespace OCA\Files_External\Tests\Controller;
+use OCA\Files_External\Lib\Auth\AuthMechanism;
+use OCA\Files_External\Lib\Backend\Backend;
use \OCP\AppFramework\Http;
use \OCA\Files_External\Controller\GlobalStoragesController;
@@ -54,7 +56,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
* @return \OCA\Files_External\Lib\Backend\Backend
*/
protected function getBackendMock($class = '\OCA\Files_External\Lib\Backend\SMB', $storageClass = '\OCA\Files_External\Lib\Storage\SMB') {
- $backend = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
+ $backend = $this->getMockBuilder(Backend::class)
->disableOriginalConstructor()
->getMock();
$backend->method('getStorageClass')
@@ -68,7 +70,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
* @return \OCA\Files_External\Lib\Auth\AuthMechanism
*/
protected function getAuthMechMock($scheme = 'null', $class = '\OCA\Files_External\Lib\Auth\NullMechanism') {
- $authMech = $this->getMockBuilder('\OCA\Files_External\Lib\Auth\AuthMechanism')
+ $authMech = $this->getMockBuilder(AuthMechanism::class)
->disableOriginalConstructor()
->getMock();
$authMech->method('getScheme')
diff --git a/apps/files_external/tests/FrontendDefinitionTraitTest.php b/apps/files_external/tests/FrontendDefinitionTraitTest.php
index 7efc7c66586..4154ac6092c 100644
--- a/apps/files_external/tests/FrontendDefinitionTraitTest.php
+++ b/apps/files_external/tests/FrontendDefinitionTraitTest.php
@@ -23,10 +23,13 @@
namespace OCA\Files_External\Tests;
+use OCA\Files_External\Lib\DefinitionParameter;
+use OCA\Files_External\Lib\StorageConfig;
+
class FrontendDefinitionTraitTest extends \Test\TestCase {
public function testJsonSerialization() {
- $param = $this->getMockBuilder('\OCA\Files_External\Lib\DefinitionParameter')
+ $param = $this->getMockBuilder(DefinitionParameter::class)
->disableOriginalConstructor()
->getMock();
$param->method('getName')->willReturn('foo');
@@ -60,7 +63,7 @@ class FrontendDefinitionTraitTest extends \Test\TestCase {
public function testValidateStorage($expectedSuccess, $params) {
$backendParams = [];
foreach ($params as $name => $valid) {
- $param = $this->getMockBuilder('\OCA\Files_External\Lib\DefinitionParameter')
+ $param = $this->getMockBuilder(DefinitionParameter::class)
->disableOriginalConstructor()
->getMock();
$param->method('getName')
@@ -73,7 +76,7 @@ class FrontendDefinitionTraitTest extends \Test\TestCase {
$backendParams[] = $param;
}
- $storageConfig = $this->getMockBuilder('\OCA\Files_External\Lib\StorageConfig')
+ $storageConfig = $this->getMockBuilder(StorageConfig::class)
->disableOriginalConstructor()
->getMock();
$storageConfig->expects($this->any())
@@ -90,7 +93,7 @@ class FrontendDefinitionTraitTest extends \Test\TestCase {
}
public function testValidateStorageSet() {
- $param = $this->getMockBuilder('\OCA\Files_External\Lib\DefinitionParameter')
+ $param = $this->getMockBuilder(DefinitionParameter::class)
->disableOriginalConstructor()
->getMock();
$param->method('getName')
@@ -102,7 +105,7 @@ class FrontendDefinitionTraitTest extends \Test\TestCase {
return true;
}));
- $storageConfig = $this->getMockBuilder('\OCA\Files_External\Lib\StorageConfig')
+ $storageConfig = $this->getMockBuilder(StorageConfig::class)
->disableOriginalConstructor()
->getMock();
$storageConfig->expects($this->once())
diff --git a/apps/files_external/tests/Service/BackendServiceTest.php b/apps/files_external/tests/Service/BackendServiceTest.php
index cbb25579e11..6916d47a02a 100644
--- a/apps/files_external/tests/Service/BackendServiceTest.php
+++ b/apps/files_external/tests/Service/BackendServiceTest.php
@@ -21,6 +21,8 @@
*/
namespace OCA\Files_External\Tests\Service;
+use OCA\Files_External\Lib\Auth\AuthMechanism;
+use OCA\Files_External\Lib\Backend\Backend;
use OCA\Files_External\Lib\Config\IAuthMechanismProvider;
use OCA\Files_External\Lib\Config\IBackendProvider;
use \OCA\Files_External\Service\BackendService;
@@ -46,7 +48,7 @@ class BackendServiceTest extends \Test\TestCase {
* @return \OCA\Files_External\Lib\Backend\Backend
*/
protected function getBackendMock($class) {
- $backend = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
+ $backend = $this->getMockBuilder(Backend::class)
->disableOriginalConstructor()
->getMock();
$backend->method('getIdentifier')->will($this->returnValue('identifier:'.$class));
@@ -60,7 +62,7 @@ class BackendServiceTest extends \Test\TestCase {
* @return \OCA\Files_External\Lib\Auth\AuthMechanism
*/
protected function getAuthMechanismMock($class) {
- $backend = $this->getMockBuilder('\OCA\Files_External\Lib\Auth\AuthMechanism')
+ $backend = $this->getMockBuilder(AuthMechanism::class)
->disableOriginalConstructor()
->getMock();
$backend->method('getIdentifier')->will($this->returnValue('identifier:'.$class));
@@ -73,7 +75,7 @@ class BackendServiceTest extends \Test\TestCase {
$backend = $this->getBackendMock('\Foo\Bar');
- $backendAlias = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
+ $backendAlias = $this->getMockBuilder(Backend::class)
->disableOriginalConstructor()
->getMock();
$backendAlias->method('getIdentifierAliases')
@@ -175,7 +177,7 @@ class BackendServiceTest extends \Test\TestCase {
->method('removeVisibility')
->with(BackendService::VISIBILITY_PERSONAL);
- $backendAlias = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
+ $backendAlias = $this->getMockBuilder(Backend::class)
->disableOriginalConstructor()
->getMock();
$backendAlias->method('getIdentifierAliases')
diff --git a/apps/files_external/tests/Service/StoragesServiceTest.php b/apps/files_external/tests/Service/StoragesServiceTest.php
index 056a03d24c8..22409ea9dbd 100644
--- a/apps/files_external/tests/Service/StoragesServiceTest.php
+++ b/apps/files_external/tests/Service/StoragesServiceTest.php
@@ -27,7 +27,9 @@ namespace OCA\Files_External\Tests\Service;
use \OC\Files\Filesystem;
+use OCA\Files_External\Lib\Auth\AuthMechanism;
use OCA\Files_External\Lib\Auth\InvalidAuth;
+use OCA\Files_External\Lib\Backend\Backend;
use OCA\Files_External\Lib\Backend\InvalidBackend;
use OCA\Files_External\NotFoundException;
use OCA\Files_External\Lib\StorageConfig;
@@ -179,7 +181,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
}
protected function getBackendMock($class = '\OCA\Files_External\Lib\Backend\SMB', $storageClass = '\OCA\Files_External\Lib\Storage\SMB') {
- $backend = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
+ $backend = $this->getMockBuilder(Backend::class)
->disableOriginalConstructor()
->getMock();
$backend->method('getStorageClass')
@@ -190,7 +192,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
}
protected function getAuthMechMock($scheme = 'null', $class = '\OCA\Files_External\Lib\Auth\NullMechanism') {
- $authMech = $this->getMockBuilder('\OCA\Files_External\Lib\Auth\AuthMechanism')
+ $authMech = $this->getMockBuilder(AuthMechanism::class)
->disableOriginalConstructor()
->getMock();
$authMech->method('getScheme')
@@ -204,7 +206,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
/**
* Creates a StorageConfig instance based on array data
*
- * @param array data
+ * @param array $data
*
* @return StorageConfig storage config instance
*/
diff --git a/apps/files_external/tests/Settings/SectionTest.php b/apps/files_external/tests/Settings/SectionTest.php
index ee501b1270b..93aee61b47d 100644
--- a/apps/files_external/tests/Settings/SectionTest.php
+++ b/apps/files_external/tests/Settings/SectionTest.php
@@ -38,8 +38,8 @@ class SectionTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')->disableOriginalConstructor()->getMock();
- $this->l = $this->getMockBuilder('\OCP\IL10N')->disableOriginalConstructor()->getMock();
+ $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->disableOriginalConstructor()->getMock();
+ $this->l = $this->getMockBuilder(IL10N::class)->disableOriginalConstructor()->getMock();
$this->section = new Section(
$this->urlGenerator,
diff --git a/apps/files_external/tests/StorageConfigTest.php b/apps/files_external/tests/StorageConfigTest.php
index 96d4fda5050..f357c0c6990 100644
--- a/apps/files_external/tests/StorageConfigTest.php
+++ b/apps/files_external/tests/StorageConfigTest.php
@@ -25,15 +25,18 @@
namespace OCA\Files_External\Tests;
+use OCA\Files_External\Lib\Auth\AuthMechanism;
+use OCA\Files_External\Lib\Backend\Backend;
+use OCA\Files_External\Lib\DefinitionParameter;
use OCA\Files_External\Lib\StorageConfig;
class StorageConfigTest extends \Test\TestCase {
public function testJsonSerialization() {
- $backend = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
+ $backend = $this->getMockBuilder(Backend::class)
->disableOriginalConstructor()
->getMock();
- $parameter = $this->getMockBuilder('\OCA\Files_External\Lib\DefinitionParameter')
+ $parameter = $this->getMockBuilder(DefinitionParameter::class)
->disableOriginalConstructor()
->getMock();
$parameter
@@ -47,7 +50,7 @@ class StorageConfigTest extends \Test\TestCase {
$backend->method('getIdentifier')
->willReturn('storage::identifier');
- $authMech = $this->getMockBuilder('\OCA\Files_External\Lib\Auth\AuthMechanism')
+ $authMech = $this->getMockBuilder(AuthMechanism::class)
->disableOriginalConstructor()
->getMock();
$authMech->method('getIdentifier')
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);
}
diff --git a/apps/files_trashbin/tests/ExpirationTest.php b/apps/files_trashbin/tests/ExpirationTest.php
index 86c9d21fe57..9d9f8ec027e 100644
--- a/apps/files_trashbin/tests/ExpirationTest.php
+++ b/apps/files_trashbin/tests/ExpirationTest.php
@@ -23,6 +23,7 @@
use OCA\Files_Trashbin\Expiration;
use \OCA\Files_Trashbin\Tests;
+use OCP\IConfig;
class ExpirationTest extends \Test\TestCase {
const SECONDS_PER_DAY = 86400; //60*60*24
@@ -200,10 +201,10 @@ class ExpirationTest extends \Test\TestCase {
/**
*
* @param string $returnValue
- * @return \OCP\IConfig
+ * @return IConfig
*/
private function getMockedConfig($returnValue){
- $mockedConfig = $this->getMockBuilder('\OCP\IConfig')
+ $mockedConfig = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->setMethods(
[
diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php
index bdddafcf016..a05fd33f306 100644
--- a/apps/files_trashbin/tests/StorageTest.php
+++ b/apps/files_trashbin/tests/StorageTest.php
@@ -37,6 +37,7 @@ use OCP\Files\Cache\ICache;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\ILogger;
+use OCP\IUserManager;
use Symfony\Component\EventDispatcher\EventDispatcher;
/**
@@ -535,7 +536,7 @@ class StorageTest extends \Test\TestCase {
$tmpStorage = $this->getMockBuilder('\OC\Files\Storage\Temporary')
->disableOriginalConstructor()->getMock($cache);
$tmpStorage->expects($this->any())->method('getCache')->willReturn($cache);
- $userManager = $this->getMockBuilder('OCP\IUserManager')
+ $userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()->getMock();
$userManager->expects($this->any())
->method('userExists')->willReturn($userExists);
diff --git a/apps/files_versions/tests/ExpirationTest.php b/apps/files_versions/tests/ExpirationTest.php
index 7fe6b279b9a..4e4f500d812 100644
--- a/apps/files_versions/tests/ExpirationTest.php
+++ b/apps/files_versions/tests/ExpirationTest.php
@@ -24,6 +24,7 @@
namespace OCA\Files_Versions\Tests;
use \OCA\Files_Versions\Expiration;
+use OCP\IConfig;
class ExpirationTest extends \Test\TestCase {
const SECONDS_PER_DAY = 86400; //60*60*24
@@ -172,7 +173,7 @@ class ExpirationTest extends \Test\TestCase {
* @return \OCP\IConfig
*/
private function getMockedConfig($returnValue){
- $mockedConfig = $this->getMockBuilder('\OCP\IConfig')
+ $mockedConfig = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->setMethods(
[
diff --git a/apps/provisioning_api/tests/Controller/AppsControllerTest.php b/apps/provisioning_api/tests/Controller/AppsControllerTest.php
index c891433258f..7bd20e4233f 100644
--- a/apps/provisioning_api/tests/Controller/AppsControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/AppsControllerTest.php
@@ -28,10 +28,9 @@
namespace OCA\Provisioning_API\Tests\Controller;
-use OC\OCSClient;
use OCA\Provisioning_API\Controller\AppsController;
-use OCP\API;
use OCP\App\IAppManager;
+use OCP\IRequest;
use OCP\IUserSession;
/**
@@ -56,7 +55,7 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
$this->groupManager = \OC::$server->getGroupManager();
$this->userSession = \OC::$server->getUserSession();
- $request = $this->getMockBuilder('OCP\IRequest')
+ $request = $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
index 344f1fe6352..9d70e123cde 100644
--- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
@@ -29,6 +29,8 @@ namespace OCA\Provisioning_API\Tests\Controller;
use OCA\Provisioning_API\Controller\GroupsController;
use OCP\IGroupManager;
use OCP\ILogger;
+use OCP\IRequest;
+use OCP\IUser;
use OCP\IUserSession;
class GroupsControllerTest extends \Test\TestCase {
@@ -59,7 +61,7 @@ class GroupsControllerTest extends \Test\TestCase {
$this->userSession = $this->getMockBuilder('OCP\IUserSession')
->disableOriginalConstructor()
->getMock();
- $request = $this->getMockBuilder('OCP\IRequest')
+ $request = $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock();
@@ -91,7 +93,7 @@ class GroupsControllerTest extends \Test\TestCase {
* @return \OCP\IUser|\PHPUnit_Framework_MockObject_MockObject
*/
private function createUser($uid) {
- $user = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $user = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$user
->method('getUID')
->willReturn($uid);
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index 692b94556c5..e9d0a704f4f 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -1128,12 +1128,12 @@ class UsersControllerTest extends TestCase {
}
public function testEditUserAdminUserSelfEditChangeValidQuota() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('UID'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser->expects($this->once())
->method('setQuota')
->with('2.9 MB');
@@ -1166,12 +1166,12 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionMessage Invalid quota value ABC
*/
public function testEditUserAdminUserSelfEditChangeInvalidQuota() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('UID'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
@@ -1195,12 +1195,12 @@ class UsersControllerTest extends TestCase {
}
public function testEditUserAdminUserEditChangeValidQuota() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('admin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser->expects($this->once())
->method('setQuota')
->with('2.9 MB');
@@ -1413,12 +1413,12 @@ class UsersControllerTest extends TestCase {
}
public function testEditUserSubadminUserAccessible() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('subadmin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser->expects($this->once())
->method('setQuota')
->with('2.9 MB');
@@ -1456,12 +1456,12 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionCode 997
*/
public function testEditUserSubadminUserInaccessible() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('subadmin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
@@ -1496,7 +1496,7 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionCode 101
*/
public function testDeleteUserNotExistingUser() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
@@ -1519,12 +1519,12 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionCode 101
*/
public function testDeleteUserSelf() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('UID'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
@@ -1543,12 +1543,12 @@ class UsersControllerTest extends TestCase {
}
public function testDeleteSuccessfulUserAsAdmin() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('admin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
@@ -1580,12 +1580,12 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionCode 101
*/
public function testDeleteUnsuccessfulUserAsAdmin() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('admin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
@@ -1613,12 +1613,12 @@ class UsersControllerTest extends TestCase {
}
public function testDeleteSuccessfulUserAsSubadmin() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('subadmin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
@@ -1661,12 +1661,12 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionCode 101
*/
public function testDeleteUnsuccessfulUserAsSubadmin() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('subadmin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
@@ -1709,12 +1709,12 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionCode 997
*/
public function testDeleteUserAsSubAdminAndUserIsNotAccessible() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('subadmin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
@@ -1753,7 +1753,7 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionCode 998
*/
public function testGetUsersGroupsTargetUserNotExisting() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
@@ -1763,12 +1763,12 @@ class UsersControllerTest extends TestCase {
}
public function testGetUsersGroupsSelfTargetted() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->once())
->method('getUID')
->will($this->returnValue('UserToLookup'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
@@ -1792,12 +1792,12 @@ class UsersControllerTest extends TestCase {
}
public function testGetUsersGroupsForAdminUser() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->exactly(2))
->method('getUID')
->will($this->returnValue('admin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
@@ -1826,12 +1826,12 @@ class UsersControllerTest extends TestCase {
}
public function testGetUsersGroupsForSubAdminUserAndUserIsAccessible() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->exactly(2))
->method('getUID')
->will($this->returnValue('subadmin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
@@ -1890,12 +1890,12 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionCode 997
*/
public function testGetUsersGroupsForSubAdminUserAndUserIsInaccessible() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->exactly(2))
->method('getUID')
->will($this->returnValue('subadmin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
@@ -2108,7 +2108,7 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionCode 101
*/
public function testRemoveFromGroupWithNoTargetGroup() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
@@ -2122,7 +2122,7 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionCode 101
*/
public function testRemoveFromGroupWithEmptyTargetGroup() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
@@ -2136,7 +2136,7 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionCode 102
*/
public function testRemoveFromGroupWithNotExistingTargetGroup() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$this->userSession
->expects($this->once())
->method('getUser')
@@ -2155,7 +2155,7 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionCode 103
*/
public function testRemoveFromGroupWithNotExistingTargetUser() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$this->userSession
->expects($this->once())
@@ -2180,12 +2180,12 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionCode 104
*/
public function testRemoveFromGroupWithoutPermission() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->once())
->method('getUID')
->will($this->returnValue('unauthorizedUser'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$this->userSession
->expects($this->once())
@@ -2222,12 +2222,12 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionMessage Cannot remove yourself from the admin group
*/
public function testRemoveFromGroupAsAdminFromAdmin() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('admin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
@@ -2272,12 +2272,12 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionMessage Cannot remove yourself from this group as you are a SubAdmin
*/
public function testRemoveFromGroupAsSubAdminFromSubAdmin() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('subadmin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser
->expects($this->once())
->method('getUID')
@@ -2327,12 +2327,12 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionMessage Cannot remove user from this group as this is the only remaining group you are a SubAdmin of
*/
public function testRemoveFromGroupAsSubAdminFromLastSubAdminGroup() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('subadmin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$targetGroup
->expects($this->any())
@@ -2384,12 +2384,12 @@ class UsersControllerTest extends TestCase {
}
public function testRemoveFromGroupSuccessful() {
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->any())
->method('getUID')
->will($this->returnValue('admin'));
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$this->userSession
->expects($this->once())
@@ -2446,7 +2446,7 @@ class UsersControllerTest extends TestCase {
*/
public function testAddSubAdminWithNotExistingTargetGroup() {
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$this->userManager
->expects($this->once())
->method('get')
@@ -2467,7 +2467,7 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionMessage Cannot create subadmins for admin group
*/
public function testAddSubAdminToAdminGroup() {
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$targetGroup
->expects($this->once())
@@ -2488,7 +2488,7 @@ class UsersControllerTest extends TestCase {
}
public function testAddSubAdminTwice() {
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$this->userManager
->expects($this->once())
@@ -2516,7 +2516,7 @@ class UsersControllerTest extends TestCase {
}
public function testAddSubAdminSuccessful() {
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$this->userManager
->expects($this->once())
@@ -2554,7 +2554,7 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionMessage Unknown error occurred
*/
public function testAddSubAdminUnsuccessful() {
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$this->userManager
->expects($this->once())
@@ -2607,7 +2607,7 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionMessage Group does not exist
*/
public function testRemoveSubAdminNotExistingTargetGroup() {
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$this->userManager
->expects($this->once())
->method('get')
@@ -2629,7 +2629,7 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionMessage User is not a subadmin of this group
*/
public function testRemoveSubAdminFromNotASubadmin() {
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$this->userManager
->expects($this->once())
@@ -2657,7 +2657,7 @@ class UsersControllerTest extends TestCase {
}
public function testRemoveSubAdminSuccessful() {
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$this->userManager
->expects($this->once())
@@ -2695,7 +2695,7 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionMessage Unknown error occurred
*/
public function testRemoveSubAdminUnsuccessful() {
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$this->userManager
->expects($this->once())
@@ -2743,7 +2743,7 @@ class UsersControllerTest extends TestCase {
}
public function testGetUserSubAdminGroupsWithGroups() {
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
$targetGroup
->expects($this->once())
@@ -2775,7 +2775,7 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionMessage Unknown error occurred
*/
public function testGetUserSubAdminGroupsWithoutGroups() {
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$this->userManager
->expects($this->once())
->method('get')
@@ -2797,7 +2797,7 @@ class UsersControllerTest extends TestCase {
}
public function testEnableUser() {
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser->expects($this->once())
->method('setEnabled')
->with(true);
@@ -2806,7 +2806,7 @@ class UsersControllerTest extends TestCase {
->method('get')
->with('RequestedUser')
->will($this->returnValue($targetUser));
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->exactly(2))
->method('getUID')
@@ -2824,7 +2824,7 @@ class UsersControllerTest extends TestCase {
}
public function testDisableUser() {
- $targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser->expects($this->once())
->method('setEnabled')
->with(false);
@@ -2833,7 +2833,7 @@ class UsersControllerTest extends TestCase {
->method('get')
->with('RequestedUser')
->will($this->returnValue($targetUser));
- $loggedInUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
+ $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$loggedInUser
->expects($this->exactly(2))
->method('getUID')
@@ -2974,14 +2974,14 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionCode 997
*/
public function testResendWelcomeMessageAsSubAdminAndUserIsNotAccessible() {
- $loggedInUser = $this->getMockBuilder('OCP\IUser')
+ $loggedInUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$loggedInUser
->expects($this->exactly(1))
->method('getUID')
->will($this->returnValue('subadmin'));
- $targetUser = $this->getMockBuilder('OCP\IUser')
+ $targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->userSession
@@ -3020,10 +3020,10 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionMessage Email address not available
*/
public function testResendWelcomeMessageNoEmail() {
- $loggedInUser = $this->getMockBuilder('OCP\IUser')
+ $loggedInUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
- $targetUser = $this->getMockBuilder('OCP\IUser')
+ $targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->userSession
@@ -3061,10 +3061,10 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionMessage Email address not available
*/
public function testResendWelcomeMessageNullEmail() {
- $loggedInUser = $this->getMockBuilder('OCP\IUser')
+ $loggedInUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
- $targetUser = $this->getMockBuilder('OCP\IUser')
+ $targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->userSession
@@ -3097,10 +3097,10 @@ class UsersControllerTest extends TestCase {
}
public function testResendWelcomeMessageSuccess() {
- $loggedInUser = $this->getMockBuilder('OCP\IUser')
+ $loggedInUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
- $targetUser = $this->getMockBuilder('OCP\IUser')
+ $targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$targetUser
@@ -3167,10 +3167,10 @@ class UsersControllerTest extends TestCase {
}
public function testResendWelcomeMessageSuccessWithFallbackLanguage() {
- $loggedInUser = $this->getMockBuilder('OCP\IUser')
+ $loggedInUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
- $targetUser = $this->getMockBuilder('OCP\IUser')
+ $targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$targetUser
@@ -3242,10 +3242,10 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionMessage Sending email failed
*/
public function testResendWelcomeMessageFailed() {
- $loggedInUser = $this->getMockBuilder('OCP\IUser')
+ $loggedInUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
- $targetUser = $this->getMockBuilder('OCP\IUser')
+ $targetUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$targetUser
diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php
index 68a645ec0e6..a04b0a355cf 100644
--- a/apps/sharebymail/tests/ShareByMailProviderTest.php
+++ b/apps/sharebymail/tests/ShareByMailProviderTest.php
@@ -103,17 +103,17 @@ class ShareByMailProviderTest extends TestCase {
$this->shareManager = \OC::$server->getShareManager();
$this->connection = \OC::$server->getDatabaseConnection();
- $this->l = $this->getMockBuilder('OCP\IL10N')->getMock();
+ $this->l = $this->getMockBuilder(IL10N::class)->getMock();
$this->l->method('t')
->will($this->returnCallback(function($text, $parameters = []) {
return vsprintf($text, $parameters);
}));
- $this->logger = $this->getMockBuilder('OCP\ILogger')->getMock();
+ $this->logger = $this->getMockBuilder(ILogger::class)->getMock();
$this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->getMock();
- $this->userManager = $this->getMockBuilder('OCP\IUserManager')->getMock();
+ $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
$this->secureRandom = $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock();
$this->mailer = $this->getMockBuilder('\OCP\Mail\IMailer')->getMock();
- $this->urlGenerator = $this->getMockBuilder('\OCP\IUrlGenerator')->getMock();
+ $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock();
$this->share = $this->getMockBuilder('\OCP\Share\IShare')->getMock();
$this->activityManager = $this->getMockBuilder('OCP\Activity\IManager')->getMock();
$this->settingsManager = $this->getMockBuilder(SettingsManager::class)->disableOriginalConstructor()->getMock();
diff --git a/apps/theming/tests/Controller/IconControllerTest.php b/apps/theming/tests/Controller/IconControllerTest.php
index c6a40b5942e..ca1f7fe0ff7 100644
--- a/apps/theming/tests/Controller/IconControllerTest.php
+++ b/apps/theming/tests/Controller/IconControllerTest.php
@@ -61,7 +61,7 @@ class IconControllerTest extends TestCase {
private $imageManager;
public function setUp() {
- $this->request = $this->getMockBuilder('OCP\IRequest')->getMock();
+ $this->request = $this->getMockBuilder(IRequest::class)->getMock();
$this->themingDefaults = $this->getMockBuilder('OCA\Theming\ThemingDefaults')
->disableOriginalConstructor()->getMock();
$this->util = $this->getMockBuilder('\OCA\Theming\Util')->disableOriginalConstructor()
@@ -69,7 +69,7 @@ class IconControllerTest extends TestCase {
$this->timeFactory = $this->getMockBuilder('OCP\AppFramework\Utility\ITimeFactory')
->disableOriginalConstructor()
->getMock();
- $this->config = $this->getMockBuilder('OCP\IConfig')->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->iconBuilder = $this->getMockBuilder('OCA\Theming\IconBuilder')
->disableOriginalConstructor()->getMock();
$this->imageManager = $this->getMockBuilder('OCA\Theming\ImageManager')->disableOriginalConstructor()->getMock();
diff --git a/apps/theming/tests/IconBuilderTest.php b/apps/theming/tests/IconBuilderTest.php
index 9b5b1933201..6821655eafe 100644
--- a/apps/theming/tests/IconBuilderTest.php
+++ b/apps/theming/tests/IconBuilderTest.php
@@ -51,7 +51,7 @@ class IconBuilderTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->appData = $this->createMock(IAppData::class);
$this->themingDefaults = $this->getMockBuilder('OCA\Theming\ThemingDefaults')
->disableOriginalConstructor()->getMock();
diff --git a/apps/theming/tests/ImageManagerTest.php b/apps/theming/tests/ImageManagerTest.php
index 4df49633d80..65bcb4dbc06 100644
--- a/apps/theming/tests/ImageManagerTest.php
+++ b/apps/theming/tests/ImageManagerTest.php
@@ -40,7 +40,7 @@ class ImageManager extends TestCase {
protected function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->appData = $this->getMockBuilder('OCP\Files\IAppData')->getMock();
$this->imageManager = new \OCA\Theming\ImageManager(
$this->config,
diff --git a/apps/theming/tests/Settings/AdminTest.php b/apps/theming/tests/Settings/AdminTest.php
index 70939677582..fb55640e968 100644
--- a/apps/theming/tests/Settings/AdminTest.php
+++ b/apps/theming/tests/Settings/AdminTest.php
@@ -45,10 +45,10 @@ class AdminTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
- $this->l10n = $this->getMockBuilder('\OCP\IL10N')->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
+ $this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
$this->themingDefaults = $this->getMockBuilder('\OCA\Theming\ThemingDefaults')->disableOriginalConstructor()->getMock();
- $this->urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')->getMock();
+ $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock();
$this->admin = new Admin(
$this->config,
diff --git a/apps/user_ldap/tests/Settings/AdminTest.php b/apps/user_ldap/tests/Settings/AdminTest.php
index cd06b27f913..86234861536 100644
--- a/apps/user_ldap/tests/Settings/AdminTest.php
+++ b/apps/user_ldap/tests/Settings/AdminTest.php
@@ -43,7 +43,7 @@ class AdminTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->l10n = $this->getMockBuilder('\OCP\IL10N')->getMock();
+ $this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
$this->admin = new Admin(
$this->l10n
diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php
index 5f6148b1332..b118a613e87 100644
--- a/apps/user_ldap/tests/User/UserTest.php
+++ b/apps/user_ldap/tests/User/UserTest.php
@@ -38,6 +38,7 @@ use OCP\Image;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Notification\IManager as INotificationManager;
+use OCP\Notification\INotification;
/**
* Class UserTest
@@ -134,7 +135,7 @@ class UserTest extends \Test\TestCase {
$uid = 'alice';
$dn = 'uid=alice,dc=foo,dc=bar';
- $uuser = $this->getMockBuilder('\OCP\IUser')
+ $uuser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$uuser->expects($this->once())
@@ -1279,7 +1280,7 @@ class UserTest extends \Test\TestCase {
return array();
}));
- $notification = $this->getMockBuilder('OCP\Notification\INotification')
+ $notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
$notification->expects($this->any())
@@ -1353,7 +1354,7 @@ class UserTest extends \Test\TestCase {
return array();
}));
- $notification = $this->getMockBuilder('OCP\Notification\INotification')
+ $notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
$notification->expects($this->any())
diff --git a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php
index 91da8931604..b7051870115 100644
--- a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php
+++ b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php
@@ -21,11 +21,12 @@
namespace OCA\WorkflowEngine\Tests\Check;
+use OCP\IL10N;
class AbstractStringCheckTest extends \Test\TestCase {
protected function getCheckMock() {
- $l = $this->getMockBuilder('OCP\IL10N')
+ $l = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()
->getMock();
$l->expects($this->any())
diff --git a/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php b/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php
index efe8f6372dd..9e313122a1f 100644
--- a/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php
+++ b/apps/workflowengine/tests/Check/RequestRemoteAddressTest.php
@@ -21,6 +21,8 @@
namespace OCA\WorkflowEngine\Tests\Check;
+use OCP\IL10N;
+use OCP\IRequest;
class RequestRemoteAddressTest extends \Test\TestCase {
@@ -31,7 +33,7 @@ class RequestRemoteAddressTest extends \Test\TestCase {
* @return \OCP\IL10N|\PHPUnit_Framework_MockObject_MockObject
*/
protected function getL10NMock() {
- $l = $this->getMockBuilder('OCP\IL10N')
+ $l = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()
->getMock();
$l->expects($this->any())
@@ -45,7 +47,7 @@ class RequestRemoteAddressTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $this->request = $this->getMockBuilder('OCP\IRequest')
+ $this->request = $this->getMockBuilder(IRequest::class)
->getMock();
}
diff --git a/apps/workflowengine/tests/Check/RequestTimeTest.php b/apps/workflowengine/tests/Check/RequestTimeTest.php
index c07b4bf8775..7249f5109f2 100644
--- a/apps/workflowengine/tests/Check/RequestTimeTest.php
+++ b/apps/workflowengine/tests/Check/RequestTimeTest.php
@@ -21,6 +21,7 @@
namespace OCA\WorkflowEngine\Tests\Check;
+use OCP\IL10N;
class RequestTimeTest extends \Test\TestCase {
@@ -31,7 +32,7 @@ class RequestTimeTest extends \Test\TestCase {
* @return \OCP\IL10N|\PHPUnit_Framework_MockObject_MockObject
*/
protected function getL10NMock() {
- $l = $this->getMockBuilder('OCP\IL10N')
+ $l = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()
->getMock();
$l->expects($this->any())