summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/tests')
-rw-r--r--apps/dav/tests/unit/AppInfo/PluginManagerTest.php104
-rw-r--r--apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php2
-rw-r--r--apps/dav/tests/unit/CalDAV/CalendarTest.php182
-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.php8
-rw-r--r--apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php6
-rw-r--r--apps/dav/tests/unit/CardDAV/SyncServiceTest.php21
-rw-r--r--apps/dav/tests/unit/Comments/CommentsNodeTest.php38
-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.php23
-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.php17
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php6
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php17
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php9
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php11
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php23
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FileTest.php36
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php38
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php67
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php2
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/NodeTest.php22
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php21
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php4
-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.php38
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php29
-rw-r--r--apps/dav/tests/unit/DAV/BrowserErrorPagePluginTest.php5
-rw-r--r--apps/dav/tests/unit/DAV/HookManagerTest.php2
-rw-r--r--apps/dav/tests/unit/DAV/Sharing/PluginTest.php6
-rw-r--r--apps/dav/tests/unit/ServerTest.php4
-rw-r--r--apps/dav/tests/unit/Settings/CalDAVSettingsTest.php58
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php9
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php6
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php59
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php12
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php9
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php19
-rw-r--r--apps/dav/tests/unit/Upload/AssemblyStreamTest.php4
-rw-r--r--apps/dav/tests/unit/Upload/FutureFileTest.php6
50 files changed, 812 insertions, 338 deletions
diff --git a/apps/dav/tests/unit/AppInfo/PluginManagerTest.php b/apps/dav/tests/unit/AppInfo/PluginManagerTest.php
new file mode 100644
index 00000000000..5776b939123
--- /dev/null
+++ b/apps/dav/tests/unit/AppInfo/PluginManagerTest.php
@@ -0,0 +1,104 @@
+<?php
+/**
+ * @author Vincent Petry <pvince81@owncloud.com>
+ *
+ * @copyright Copyright (c) 2016, ownCloud GmbH.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\DAV\Tests\unit\AppInfo;
+
+use Test\TestCase;
+use OCP\App\IAppManager;
+use OC\ServerContainer;
+use OCA\DAV\AppInfo\PluginManager;
+
+/**
+ * Class PluginManagerTest
+ *
+ * @package OCA\DAV\Tests\Unit\AppInfo
+ */
+class PluginManagerTest extends TestCase {
+ public function test() {
+ $server = $this->createMock(ServerContainer::class);
+
+
+ $appManager = $this->createMock(IAppManager::class);
+ $appManager->method('getInstalledApps')
+ ->willReturn(['adavapp', 'adavapp2']);
+
+ $appInfo1 = [
+ 'types' => ['dav'],
+ 'sabre' => [
+ 'plugins' => [
+ 'plugin' => [
+ '\OCA\DAV\ADavApp\PluginOne',
+ '\OCA\DAV\ADavApp\PluginTwo',
+ ],
+ ],
+ 'collections' => [
+ 'collection' => [
+ '\OCA\DAV\ADavApp\CollectionOne',
+ '\OCA\DAV\ADavApp\CollectionTwo',
+ ]
+ ],
+ ],
+ ];
+ $appInfo2 = [
+ 'types' => ['logging', 'dav'],
+ 'sabre' => [
+ 'plugins' => [
+ 'plugin' => '\OCA\DAV\ADavApp2\PluginOne',
+ ],
+ 'collections' => [
+ 'collection' => '\OCA\DAV\ADavApp2\CollectionOne',
+ ],
+ ],
+ ];
+
+ $appManager->method('getAppInfo')
+ ->will($this->returnValueMap([
+ ['adavapp', $appInfo1],
+ ['adavapp2', $appInfo2],
+ ]));
+
+ $pluginManager = new PluginManager($server, $appManager);
+
+ $server->method('query')
+ ->will($this->returnValueMap([
+ ['\OCA\DAV\ADavApp\PluginOne', 'dummyplugin1'],
+ ['\OCA\DAV\ADavApp\PluginTwo', 'dummyplugin2'],
+ ['\OCA\DAV\ADavApp\CollectionOne', 'dummycollection1'],
+ ['\OCA\DAV\ADavApp\CollectionTwo', 'dummycollection2'],
+ ['\OCA\DAV\ADavApp2\PluginOne', 'dummy2plugin1'],
+ ['\OCA\DAV\ADavApp2\CollectionOne', 'dummy2collection1'],
+ ]));
+
+ $expectedPlugins = [
+ 'dummyplugin1',
+ 'dummyplugin2',
+ 'dummy2plugin1',
+ ];
+ $expectedCollections = [
+ 'dummycollection1',
+ 'dummycollection2',
+ 'dummy2collection1',
+ ];
+
+ $this->assertEquals($expectedPlugins, $pluginManager->getAppPlugins());
+ $this->assertEquals($expectedCollections, $pluginManager->getAppCollections());
+ }
+}
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..3fb29fd0c6b 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())
@@ -381,4 +381,184 @@ EOD;
[2, true]
];
}
+
+ public function testRemoveVAlarms() {
+ $publicObjectData = <<<EOD
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Nextcloud calendar v1.5.6
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20171022T125130
+DTSTAMP:20171022T125130
+LAST-MODIFIED:20171022T125130
+UID:PPL24TH8UGOWE94XET87ER
+SUMMARY:Foo bar blub
+CLASS:PUBLIC
+STATUS:CONFIRMED
+DTSTART;VALUE=DATE:20171024
+DTEND;VALUE=DATE:20171025
+BEGIN:VALARM
+ACTION:AUDIO
+TRIGGER:-PT15M
+END:VALARM
+END:VEVENT
+END:VCALENDAR
+
+EOD;
+
+ $confidentialObjectData = <<<EOD
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Nextcloud calendar v1.5.6
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20171022T125130
+DTSTAMP:20171022T125130
+LAST-MODIFIED:20171022T125130
+UID:PPL24TH8UGOWE94XET87ER
+SUMMARY:Foo bar blub
+CLASS:CONFIDENTIAL
+STATUS:CONFIRMED
+DTSTART;VALUE=DATE:20171024
+DTEND;VALUE=DATE:20171025
+BEGIN:VALARM
+ACTION:AUDIO
+TRIGGER:-PT15M
+END:VALARM
+END:VEVENT
+END:VCALENDAR
+
+EOD;
+
+ $publicObjectDataWithoutVAlarm = <<<EOD
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Nextcloud calendar v1.5.6
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20171022T125130
+DTSTAMP:20171022T125130
+LAST-MODIFIED:20171022T125130
+UID:PPL24TH8UGOWE94XET87ER
+SUMMARY:Foo bar blub
+CLASS:PUBLIC
+STATUS:CONFIRMED
+DTSTART;VALUE=DATE:20171024
+DTEND;VALUE=DATE:20171025
+END:VEVENT
+END:VCALENDAR
+
+EOD;
+
+ $confidentialObjectCleaned = <<<EOD
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Nextcloud calendar v1.5.6
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+CREATED:20171022T125130
+UID:PPL24TH8UGOWE94XET87ER
+SUMMARY:Busy
+CLASS:CONFIDENTIAL
+DTSTART;VALUE=DATE:20171024
+DTEND;VALUE=DATE:20171025
+END:VEVENT
+END:VCALENDAR
+
+EOD;
+
+
+
+ $publicObject = ['uri' => 'event-0',
+ 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC,
+ 'calendardata' => $publicObjectData];
+
+ $confidentialObject = ['uri' => 'event-1',
+ 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL,
+ 'calendardata' => $confidentialObjectData];
+
+ /** @var \PHPUnit_Framework_MockObject_MockObject | CalDavBackend $backend */
+ $backend = $this->createMock(CalDavBackend::class);
+ $backend->expects($this->any())
+ ->method('getCalendarObjects')
+ ->willReturn([$publicObject, $confidentialObject]);
+
+ $backend->expects($this->any())
+ ->method('getMultipleCalendarObjects')
+ ->with(666, ['event-0', 'event-1'])
+ ->willReturn([$publicObject, $confidentialObject]);
+
+ $backend->expects($this->any())
+ ->method('getCalendarObject')
+ ->will($this->returnCallback(function($cId, $uri) use($publicObject, $confidentialObject) {
+ switch($uri) {
+ case 'event-0':
+ return $publicObject;
+
+ case 'event-1':
+ return $confidentialObject;
+
+ default:
+ throw new \Exception('unexpected uri');
+ }
+ }));
+
+ $backend->expects($this->any())
+ ->method('applyShareAcl')
+ ->willReturnArgument(1);
+
+ $calendarInfoOwner = [
+ '{http://owncloud.org/ns}owner-principal' => 'user1',
+ 'principaluri' => 'user1',
+ 'id' => 666,
+ 'uri' => 'cal',
+ ];
+ $calendarInfoSharedRW = [
+ '{http://owncloud.org/ns}owner-principal' => 'user1',
+ 'principaluri' => 'user2',
+ 'id' => 666,
+ 'uri' => 'cal',
+ ];
+ $calendarInfoSharedRO = [
+ '{http://owncloud.org/ns}owner-principal' => 'user1',
+ '{http://owncloud.org/ns}read-only' => true,
+ 'principaluri' => 'user2',
+ 'id' => 666,
+ 'uri' => 'cal',
+ ];
+
+ $ownerCalendar = new Calendar($backend, $calendarInfoOwner, $this->l10n);
+ $rwCalendar = new Calendar($backend, $calendarInfoSharedRW, $this->l10n);
+ $roCalendar = new Calendar($backend, $calendarInfoSharedRO, $this->l10n);
+
+ $this->assertEquals(count($ownerCalendar->getChildren()), 2);
+ $this->assertEquals(count($rwCalendar->getChildren()), 2);
+ $this->assertEquals(count($roCalendar->getChildren()), 2);
+
+ // calendar data shall not be altered for the owner
+ $this->assertEquals($ownerCalendar->getChild('event-0')->get(), $publicObjectData);
+ $this->assertEquals($ownerCalendar->getChild('event-1')->get(), $confidentialObjectData);
+
+ // valarms shall not be removed for read-write shares
+ $this->assertEquals(
+ $this->fixLinebreak($rwCalendar->getChild('event-0')->get()),
+ $this->fixLinebreak($publicObjectData));
+ $this->assertEquals(
+ $this->fixLinebreak($rwCalendar->getChild('event-1')->get()),
+ $this->fixLinebreak($confidentialObjectCleaned));
+
+ // valarms shall be removed for read-only shares
+ $this->assertEquals(
+ $this->fixLinebreak($roCalendar->getChild('event-0')->get()),
+ $this->fixLinebreak($publicObjectDataWithoutVAlarm));
+ $this->assertEquals(
+ $this->fixLinebreak($roCalendar->getChild('event-1')->get()),
+ $this->fixLinebreak($confidentialObjectCleaned));
+
+ }
+
+ private function fixLinebreak($str) {
+ return preg_replace('~(*BSR_ANYCRLF)\R~', "\r\n", $str);
+ }
}
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..9ab0631e93a 100644
--- a/apps/dav/tests/unit/CardDAV/ConverterTest.php
+++ b/apps/dav/tests/unit/CardDAV/ConverterTest.php
@@ -46,15 +46,15 @@ class ConverterTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->databaseConnection = $this->getMockBuilder('OCP\IDBConnection')->getMock();
- $this->eventDispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
+ $this->databaseConnection = $this->getMockBuilder(IDBConnection::class)->getMock();
+ $this->eventDispatcher = $this->getMockBuilder(EventDispatcher::class)
->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..4d4070511bb 100644
--- a/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php
+++ b/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php
@@ -47,17 +47,17 @@ class PluginTest extends TestCase {
parent::setUp();
/** @var Auth | \PHPUnit_Framework_MockObject_MockObject $authBackend */
- $authBackend = $this->getMockBuilder('OCA\DAV\Connector\Sabre\Auth')->disableOriginalConstructor()->getMock();
+ $authBackend = $this->getMockBuilder(Auth::class)->disableOriginalConstructor()->getMock();
$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');
$this->server = new \Sabre\DAV\Server($root);
/** @var SimpleCollection $node */
- $this->book = $this->getMockBuilder('OCA\DAV\DAV\Sharing\IShareable')->disableOriginalConstructor()->getMock();
+ $this->book = $this->getMockBuilder(IShareable::class)->disableOriginalConstructor()->getMock();
$this->book->method('getName')->willReturn('addressbook1.vcf');
$root->addChild($this->book);
$this->plugin->initialize($this->server);
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..a0ff029efa7 100644
--- a/apps/dav/tests/unit/Comments/CommentsNodeTest.php
+++ b/apps/dav/tests/unit/Comments/CommentsNodeTest.php
@@ -26,8 +26,14 @@
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;
+use Sabre\DAV\PropPatch;
class CommentsNodeTest extends \Test\TestCase {
@@ -43,19 +49,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 +75,7 @@ class CommentsNodeTest extends \Test\TestCase {
}
public function testDelete() {
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@@ -104,7 +110,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 +162,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 +194,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 +239,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 +279,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 +314,7 @@ class CommentsNodeTest extends \Test\TestCase {
public function testUpdateForbiddenByType() {
$msg = 'HaXX0r';
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@@ -356,7 +362,7 @@ class CommentsNodeTest extends \Test\TestCase {
}
public function testPropPatch() {
- $propPatch = $this->getMockBuilder('Sabre\DAV\PropPatch')
+ $propPatch = $this->getMockBuilder(PropPatch::class)
->disableOriginalConstructor()
->getMock();
@@ -461,7 +467,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 +521,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..dbb39bac6d2 100644
--- a/apps/dav/tests/unit/Connector/PublicAuthTest.php
+++ b/apps/dav/tests/unit/Connector/PublicAuthTest.php
@@ -28,6 +28,7 @@ use OCP\IRequest;
use OCP\ISession;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager;
+use OCP\Share\IShare;
/**
* Class PublicAuthTest
@@ -53,13 +54,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();
@@ -94,7 +95,7 @@ class PublicAuthTest extends \Test\TestCase {
}
public function testShareNoPassword() {
- $share = $this->getMockBuilder('OCP\Share\IShare')
+ $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
$share->method('getPassword')->willReturn(null);
@@ -109,7 +110,7 @@ class PublicAuthTest extends \Test\TestCase {
}
public function testSharePasswordFancyShareType() {
- $share = $this->getMockBuilder('OCP\Share\IShare')
+ $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
$share->method('getPassword')->willReturn('password');
@@ -126,7 +127,7 @@ class PublicAuthTest extends \Test\TestCase {
public function testSharePasswordRemote() {
- $share = $this->getMockBuilder('OCP\Share\IShare')
+ $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
$share->method('getPassword')->willReturn('password');
@@ -142,7 +143,7 @@ class PublicAuthTest extends \Test\TestCase {
}
public function testSharePasswordLinkValidPassword() {
- $share = $this->getMockBuilder('OCP\Share\IShare')
+ $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
$share->method('getPassword')->willReturn('password');
@@ -164,7 +165,7 @@ class PublicAuthTest extends \Test\TestCase {
}
public function testSharePasswordMailValidPassword() {
- $share = $this->getMockBuilder('OCP\Share\IShare')
+ $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
$share->method('getPassword')->willReturn('password');
@@ -186,7 +187,7 @@ class PublicAuthTest extends \Test\TestCase {
}
public function testSharePasswordLinkValidSession() {
- $share = $this->getMockBuilder('OCP\Share\IShare')
+ $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
$share->method('getPassword')->willReturn('password');
@@ -212,7 +213,7 @@ class PublicAuthTest extends \Test\TestCase {
}
public function testSharePasswordLinkInvalidSession() {
- $share = $this->getMockBuilder('OCP\Share\IShare')
+ $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
$share->method('getPassword')->willReturn('password');
@@ -239,7 +240,7 @@ class PublicAuthTest extends \Test\TestCase {
public function testSharePasswordMailInvalidSession() {
- $share = $this->getMockBuilder('OCP\Share\IShare')
+ $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor()
->getMock();
$share->method('getPassword')->willReturn('password');
diff --git a/apps/dav/tests/unit/Connector/Sabre/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..c31a3af980b 100644
--- a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
@@ -25,6 +25,11 @@
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;
+use Sabre\DAV\PropFind;
class CommentsPropertiesPluginTest extends \Test\TestCase {
@@ -37,10 +42,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();
@@ -73,7 +78,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
* @param $expectedSuccessful
*/
public function testHandleGetProperties($node, $expectedSuccessful) {
- $propFind = $this->getMockBuilder('\Sabre\DAV\PropFind')
+ $propFind = $this->getMockBuilder(PropFind::class)
->disableOriginalConstructor()
->getMock();
@@ -103,7 +108,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 +126,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
public function userProvider() {
return [
[
- $this->getMockBuilder('\OCP\IUser')
+ $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock()
],
@@ -134,7 +139,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/CopyEtagHeaderPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php
index 773d5d7f98b..f44a4abf634 100644
--- a/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php
@@ -24,7 +24,9 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin;
+use OCA\DAV\Connector\Sabre\File;
use Sabre\DAV\Server;
+use Sabre\DAV\Tree;
use Test\TestCase;
/**
@@ -68,13 +70,13 @@ class CopyEtagHeaderPluginTest extends TestCase {
}
public function testAfterMove() {
- $node = $this->getMockBuilder('OCA\DAV\Connector\Sabre\File')
+ $node = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
->method('getETag')
->willReturn('123456');
- $tree = $this->getMockBuilder('Sabre\DAV\Tree')
+ $tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
->getMock();
$tree->expects($this->once())
diff --git a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
index f0f4caa07a0..c96915244f7 100644
--- a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
@@ -31,6 +31,11 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
* See the COPYING-README file.
*/
+use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Connector\Sabre\File;
+use OCP\IUser;
+use Sabre\DAV\Tree;
+
/**
* Class CustomPropertiesBackend
*
@@ -63,13 +68,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())
@@ -175,7 +180,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
* Test setting/getting properties
*/
public function testSetGetPropertiesForFile() {
- $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
+ $node = $this->createTestNode(File::class);
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/dummypath')
@@ -207,9 +212,9 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
* Test getting properties from directory
*/
public function testGetPropertiesForDirectory() {
- $rootNode = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory');
+ $rootNode = $this->createTestNode(Directory::class);
- $nodeSub = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $nodeSub = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$nodeSub->expects($this->any())
@@ -291,7 +296,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
* Test delete property
*/
public function testDeleteProperty() {
- $node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
+ $node = $this->createTestNode(File::class);
$this->tree->expects($this->any())
->method('getNodeForPath')
->with('/dummypath')
diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
index f27f67b0aae..d5da0dce0d1 100644
--- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
@@ -26,6 +26,7 @@
namespace OCA\DAV\Tests\Unit\Connector\Sabre;
+use OC\Files\Storage\Wrapper\Quota;
use OCP\Files\ForbiddenException;
use OC\Files\FileInfo;
use OCA\DAV\Connector\Sabre\Directory;
@@ -179,10 +180,10 @@ class DirectoryTest extends \Test\TestCase {
}
public function testGetChildren() {
- $info1 = $this->getMockBuilder('OC\Files\FileInfo')
+ $info1 = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()
->getMock();
- $info2 = $this->getMockBuilder('OC\Files\FileInfo')
+ $info2 = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()
->getMock();
$info1->expects($this->any())
@@ -269,7 +270,7 @@ class DirectoryTest extends \Test\TestCase {
}
public function testGetQuotaInfoUnlimited() {
- $storage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Quota')
+ $storage = $this->getMockBuilder(Quota::class)
->disableOriginalConstructor()
->getMock();
@@ -300,7 +301,7 @@ class DirectoryTest extends \Test\TestCase {
}
public function testGetQuotaInfoSpecific() {
- $storage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Quota')
+ $storage = $this->getMockBuilder(Quota::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php b/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php
index 1c2e249e8c0..fa6f849f12f 100644
--- a/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php
@@ -26,6 +26,9 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin;
+use Sabre\DAV\Server;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
use Test\TestCase;
/**
@@ -44,8 +47,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
@@ -59,11 +62,11 @@ class DummyGetResponsePluginTest extends TestCase {
public function testHttpGet() {
/** @var \Sabre\HTTP\RequestInterface $request */
- $request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface')
+ $request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
/** @var \Sabre\HTTP\ResponseInterface $response */
- $response = $server = $this->getMockBuilder('\Sabre\HTTP\ResponseInterface')
+ $response = $server = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
->getMock();
$response
diff --git a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
index abf6e5cf182..e42bb1704f0 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
@@ -25,7 +25,12 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OCA\DAV\Connector\Sabre\FakeLockerPlugin;
+use Sabre\DAV\INode;
+use Sabre\DAV\PropFind;
+use Sabre\DAV\Server;
+use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\Response;
+use Sabre\HTTP\ResponseInterface;
use Test\TestCase;
/**
@@ -43,8 +48,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
@@ -83,10 +88,10 @@ class FakeLockerPluginTest extends TestCase {
}
public function testPropFind() {
- $propFind = $this->getMockBuilder('\Sabre\DAV\PropFind')
+ $propFind = $this->getMockBuilder(PropFind::class)
->disableOriginalConstructor()
->getMock();
- $node = $this->getMockBuilder('\Sabre\DAV\INode')
+ $node = $this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock();
@@ -143,7 +148,7 @@ class FakeLockerPluginTest extends TestCase {
* @param array $expected
*/
public function testValidateTokens(array $input, array $expected) {
- $request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface')
+ $request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
$this->fakeLockerPlugin->validateTokens($request, $input);
@@ -151,11 +156,11 @@ class FakeLockerPluginTest extends TestCase {
}
public function testFakeLockProvider() {
- $request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface')
+ $request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
$response = new Response();
- $server = $this->getMockBuilder('\Sabre\DAV\Server')
+ $server = $this->getMockBuilder(Server::class)
->getMock();
$this->fakeLockerPlugin->initialize($server);
@@ -171,10 +176,10 @@ class FakeLockerPluginTest extends TestCase {
}
public function testFakeUnlockProvider() {
- $request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface')
+ $request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
- $response = $this->getMockBuilder('\Sabre\HTTP\ResponseInterface')
+ $response = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
index e2666d0de27..bf9daebdc5b 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
@@ -880,7 +882,7 @@ class FileTest extends \Test\TestCase {
$wasLockedPre = false;
$wasLockedPost = false;
- $eventHandler = $this->getMockBuilder('\stdclass')
+ $eventHandler = $this->getMockBuilder(\stdclass::class)
->setMethods(['writeCallback', 'postWriteCallback'])
->getMock();
@@ -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..e3cf1ff4453 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
@@ -25,10 +25,18 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OC\User\User;
+use OCA\DAV\Connector\Sabre\File;
use OCA\DAV\Connector\Sabre\FilesPlugin;
+use OCA\DAV\Connector\Sabre\Node;
use OCP\Files\StorageNotAvailableException;
+use OCP\IConfig;
+use OCP\IPreview;
+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 +95,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();
@@ -182,7 +190,7 @@ class FilesPluginTest extends TestCase {
0
);
- $user = $this->getMockBuilder('\OC\User\User')
+ $user = $this->getMockBuilder(User::class)
->disableOriginalConstructor()->getMock();
$user
->expects($this->once())
@@ -245,7 +253,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 +319,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 +355,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('/');
@@ -451,14 +459,14 @@ class FilesPluginTest extends TestCase {
* @expectedExceptionMessage FolderA/test.txt cannot be deleted
*/
public function testMoveSrcNotDeletable() {
- $fileInfoFolderATestTXT = $this->getMockBuilder('\OCP\Files\FileInfo')
+ $fileInfoFolderATestTXT = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()
->getMock();
$fileInfoFolderATestTXT->expects($this->once())
->method('isDeletable')
->willReturn(false);
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
+ $node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
@@ -472,14 +480,14 @@ class FilesPluginTest extends TestCase {
}
public function testMoveSrcDeletable() {
- $fileInfoFolderATestTXT = $this->getMockBuilder('\OCP\Files\FileInfo')
+ $fileInfoFolderATestTXT = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()
->getMock();
$fileInfoFolderATestTXT->expects($this->once())
->method('isDeletable')
->willReturn(true);
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
+ $node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
@@ -497,7 +505,7 @@ class FilesPluginTest extends TestCase {
* @expectedExceptionMessage FolderA/test.txt does not exist
*/
public function testMoveSrcNotExist() {
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
+ $node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->once())
@@ -539,7 +547,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..c46e4b14805 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
@@ -24,10 +24,16 @@
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\ISystemTag;
use OCP\SystemTag\ISystemTagObjectMapper;
use OC\Files\View;
use OCP\Files\Folder;
@@ -35,6 +41,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 +81,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 +98,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 +120,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 +149,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 +169,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 +215,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 +239,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 +265,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 +306,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 +328,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 +362,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 +387,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 +395,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
@@ -542,7 +551,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('isAdmin')
->will($this->returnValue(true));
- $tag1 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag')
+ $tag1 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor()
->getMock();
$tag1->expects($this->any())
@@ -552,7 +561,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('isUserVisible')
->will($this->returnValue(true));
- $tag2 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag')
+ $tag2 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor()
->getMock();
$tag2->expects($this->any())
@@ -591,7 +600,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('isAdmin')
->will($this->returnValue(false));
- $tag1 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag')
+ $tag1 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor()
->getMock();
$tag1->expects($this->any())
@@ -601,7 +610,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('isUserVisible')
->will($this->returnValue(true));
- $tag2 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag')
+ $tag2 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor()
->getMock();
$tag2->expects($this->any())
@@ -629,7 +638,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('isAdmin')
->will($this->returnValue(false));
- $tag1 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag')
+ $tag1 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor()
->getMock();
$tag1->expects($this->any())
@@ -639,7 +648,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('isUserVisible')
->will($this->returnValue(true));
- $tag2 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag')
+ $tag2 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor()
->getMock();
$tag2->expects($this->any())
diff --git a/apps/dav/tests/unit/Connector/Sabre/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..fe6cbd97829 100644
--- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
@@ -25,6 +25,12 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OC\Files\FileInfo;
+use OC\Files\View;
+use OCP\Files\Mount\IMountPoint;
+use OCP\Files\Storage;
+use OCP\Share\IManager;
+use OCP\Share\IShare;
/**
* Class NodeTest
@@ -51,7 +57,7 @@ class NodeTest extends \Test\TestCase {
* @dataProvider davPermissionsProvider
*/
public function testDavPermissions($permissions, $type, $shared, $mounted, $expected) {
- $info = $this->getMockBuilder('\OC\Files\FileInfo')
+ $info = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()
->setMethods(array('getPermissions', 'isShared', 'isMounted', 'getType'))
->getMock();
@@ -67,7 +73,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,17 +125,17 @@ 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);
- $mountpoint = $this->getMockBuilder('\OCP\Files\Mount\IMountPoint')
+ $mountpoint = $this->getMockBuilder(IMountPoint::class)
->disableOriginalConstructor()
->getMock();
$mountpoint->method('getMountPoint')->willReturn('myPath');
- $shareManager = $this->getMockBuilder('OCP\Share\IManager')->disableOriginalConstructor()->getMock();
- $share = $this->getMockBuilder('OCP\Share\IShare')->disableOriginalConstructor()->getMock();
+ $shareManager = $this->getMockBuilder(IManager::class)->disableOriginalConstructor()->getMock();
+ $share = $this->getMockBuilder(IShare::class)->disableOriginalConstructor()->getMock();
if ($user === null) {
$shareManager->expects($this->never())->method('getShareByToken');
@@ -140,7 +146,7 @@ class NodeTest extends \Test\TestCase {
$share->expects($this->once())->method('getPermissions')->willReturn($permissions);
}
- $info = $this->getMockBuilder('\OC\Files\FileInfo')
+ $info = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()
->setMethods(['getStorage', 'getType', 'getMountPoint'])
->getMock();
@@ -149,7 +155,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..d1b37541dc3 100644
--- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
@@ -31,6 +31,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OC\Files\FileInfo;
use OC\Files\Filesystem;
+use OC\Files\Mount\Manager;
use OC\Files\Storage\Temporary;
use OC\Files\View;
use OCA\DAV\Connector\Sabre\Directory;
@@ -156,16 +157,16 @@ 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')
+ $mountManager = $this->getMockBuilder(Manager::class)
->disableOriginalConstructor()
->getMock();
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
- $fileInfo = $this->getMockBuilder('\OCP\Files\FileInfo')
+ $fileInfo = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()
->getMock();
$fileInfo->expects($this->once())
@@ -275,7 +276,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,10 +285,10 @@ 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')
+ $mountManager = $this->getMockBuilder(Manager::class)
->getMock();
$tree = new \OCA\DAV\Connector\Sabre\ObjectTree();
@@ -302,7 +303,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,10 +312,10 @@ 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')
+ $mountManager = $this->getMockBuilder(Manager::class)
->getMock();
$tree = new \OCA\DAV\Connector\Sabre\ObjectTree();
diff --git a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
index d29080539e6..927178996c9 100644
--- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
@@ -176,7 +176,7 @@ class QuotaPluginTest extends TestCase {
public function testCheckQuotaChunkedOk($quota, $chunkTotalSize, $headers) {
$this->init($quota, 'sub/test.txt');
- $mockChunking = $this->getMockBuilder('\OC_FileChunking')
+ $mockChunking = $this->getMockBuilder(\OC_FileChunking::class)
->disableOriginalConstructor()
->getMock();
$mockChunking->expects($this->once())
@@ -212,7 +212,7 @@ class QuotaPluginTest extends TestCase {
public function testCheckQuotaChunkedFail($quota, $chunkTotalSize, $headers) {
$this->init($quota, 'sub/test.txt');
- $mockChunking = $this->getMockBuilder('\OC_FileChunking')
+ $mockChunking = $this->getMockBuilder(\OC_FileChunking::class)
->disableOriginalConstructor()
->getMock();
$mockChunking->expects($this->once())
diff --git a/apps/dav/tests/unit/Connector/Sabre/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..57be6e5a9e2 100644
--- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
@@ -23,6 +23,16 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Connector\Sabre\File;
+use OCA\DAV\Connector\Sabre\Node;
+use OCP\Files\Folder;
+use OCP\IUser;
+use OCP\IUserSession;
+use OCP\Share\IManager;
+use OCP\Share\IShare;
+use Sabre\DAV\Tree;
+
class SharesPluginTest extends \Test\TestCase {
const SHARETYPES_PROPERTYNAME = \OCA\DAV\Connector\Sabre\SharesPlugin::SHARETYPES_PROPERTYNAME;
@@ -55,26 +65,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();
@@ -91,7 +101,7 @@ class SharesPluginTest extends \Test\TestCase {
* @dataProvider sharesGetPropertiesDataProvider
*/
public function testGetProperties($shareTypes) {
- $sabreNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
+ $sabreNode = $this->getMockBuilder(Node::class)
->disableOriginalConstructor()
->getMock();
$sabreNode->expects($this->any())
@@ -102,7 +112,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 +159,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 +167,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 +177,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 +191,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())
@@ -206,7 +216,7 @@ class SharesPluginTest extends \Test\TestCase {
->will($this->returnValue($node));
$dummyShares = array_map(function($type) {
- $share = $this->getMockBuilder('\OCP\Share\IShare')->getMock();
+ $share = $this->getMockBuilder(IShare::class)->getMock();
$share->expects($this->any())
->method('getShareType')
->will($this->returnValue($type));
diff --git a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
index 9189a73f77f..af156310887 100644
--- a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
@@ -24,6 +24,13 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Connector\Sabre\File;
+use OCA\DAV\Connector\Sabre\Node;
+use OCP\ITagManager;
+use OCP\ITags;
+use Sabre\DAV\Tree;
+
/**
* Copyright (c) 2014 Vincent Petry <pvince81@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
@@ -42,7 +49,7 @@ class TagsPluginTest extends \Test\TestCase {
private $server;
/**
- * @var \Sabre\DAV\Tree
+ * @var Tree
*/
private $tree;
@@ -64,13 +71,13 @@ 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')
+ $this->tagger = $this->getMockBuilder(ITags::class)
->disableOriginalConstructor()
->getMock();
- $this->tagManager = $this->getMockBuilder('\OCP\ITagManager')
+ $this->tagManager = $this->getMockBuilder(ITagManager::class)
->disableOriginalConstructor()
->getMock();
$this->tagManager->expects($this->any())
@@ -85,7 +92,7 @@ class TagsPluginTest extends \Test\TestCase {
* @dataProvider tagsGetPropertiesDataProvider
*/
public function testGetProperties($tags, $requestedProperties, $expectedProperties) {
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
+ $node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
@@ -124,13 +131,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 +152,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())
@@ -260,7 +267,7 @@ class TagsPluginTest extends \Test\TestCase {
public function testUpdateTags() {
// this test will replace the existing tags "tagremove" with "tag1" and "tag2"
// and keep "tagkeep"
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
+ $node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
@@ -311,7 +318,7 @@ class TagsPluginTest extends \Test\TestCase {
}
public function testUpdateTagsFromScratch() {
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
+ $node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
@@ -359,7 +366,7 @@ class TagsPluginTest extends \Test\TestCase {
public function testUpdateFav() {
// this test will replace the existing tags "tagremove" with "tag1" and "tag2"
// and keep "tagkeep"
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
+ $node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
diff --git a/apps/dav/tests/unit/DAV/BrowserErrorPagePluginTest.php b/apps/dav/tests/unit/DAV/BrowserErrorPagePluginTest.php
index cdeaceefedf..32f19e9ddb9 100644
--- a/apps/dav/tests/unit/DAV/BrowserErrorPagePluginTest.php
+++ b/apps/dav/tests/unit/DAV/BrowserErrorPagePluginTest.php
@@ -26,6 +26,7 @@ namespace OCA\DAV\Tests\unit\DAV;
use OCA\DAV\Files\BrowserErrorPagePlugin;
use PHPUnit_Framework_MockObject_MockObject;
use Sabre\DAV\Exception\NotFound;
+use Sabre\HTTP\Response;
class BrowserErrorPagePluginTest extends \Test\TestCase {
@@ -36,13 +37,13 @@ class BrowserErrorPagePluginTest extends \Test\TestCase {
*/
public function test($expectedCode, $exception) {
/** @var BrowserErrorPagePlugin | PHPUnit_Framework_MockObject_MockObject $plugin */
- $plugin = $this->getMockBuilder('OCA\DAV\Files\BrowserErrorPagePlugin')->setMethods(['sendResponse', 'generateBody'])->getMock();
+ $plugin = $this->getMockBuilder(BrowserErrorPagePlugin::class)->setMethods(['sendResponse', 'generateBody'])->getMock();
$plugin->expects($this->once())->method('generateBody')->willReturn(':boom:');
$plugin->expects($this->once())->method('sendResponse');
/** @var \Sabre\DAV\Server | PHPUnit_Framework_MockObject_MockObject $server */
$server = $this->getMockBuilder('Sabre\DAV\Server')->disableOriginalConstructor()->getMock();
$server->expects($this->once())->method('on');
- $httpResponse = $this->getMockBuilder('Sabre\HTTP\Response')->disableOriginalConstructor()->getMock();
+ $httpResponse = $this->getMockBuilder(Response::class)->disableOriginalConstructor()->getMock();
$httpResponse->expects($this->once())->method('addHeaders');
$httpResponse->expects($this->once())->method('setStatus')->with($expectedCode);
$httpResponse->expects($this->once())->method('setBody')->with(':boom:');
diff --git a/apps/dav/tests/unit/DAV/HookManagerTest.php b/apps/dav/tests/unit/DAV/HookManagerTest.php
index a78ffea5af4..3296d550a6b 100644
--- a/apps/dav/tests/unit/DAV/HookManagerTest.php
+++ b/apps/dav/tests/unit/DAV/HookManagerTest.php
@@ -42,7 +42,7 @@ class HookManagerTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->eventDispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')->disableOriginalConstructor()->getMock();
+ $this->eventDispatcher = $this->getMockBuilder(EventDispatcher::class)->disableOriginalConstructor()->getMock();
$this->l10n = $this->createMock(IL10N::class);
$this->l10n
->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..d6291467e47 100644
--- a/apps/dav/tests/unit/DAV/Sharing/PluginTest.php
+++ b/apps/dav/tests/unit/DAV/Sharing/PluginTest.php
@@ -47,17 +47,17 @@ class PluginTest extends TestCase {
parent::setUp();
/** @var Auth | \PHPUnit_Framework_MockObject_MockObject $authBackend */
- $authBackend = $this->getMockBuilder('OCA\DAV\Connector\Sabre\Auth')->disableOriginalConstructor()->getMock();
+ $authBackend = $this->getMockBuilder(Auth::class)->disableOriginalConstructor()->getMock();
$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');
$this->server = new \Sabre\DAV\Server($root);
/** @var SimpleCollection $node */
- $this->book = $this->getMockBuilder('OCA\DAV\DAV\Sharing\IShareable')->
+ $this->book = $this->getMockBuilder(IShareable::class)->
disableOriginalConstructor()->
getMock();
$this->book->method('getName')->willReturn('addressbook1.vcf');
diff --git a/apps/dav/tests/unit/ServerTest.php b/apps/dav/tests/unit/ServerTest.php
index 19e75c7b24e..1b430b0f198 100644
--- a/apps/dav/tests/unit/ServerTest.php
+++ b/apps/dav/tests/unit/ServerTest.php
@@ -26,6 +26,7 @@ namespace OCA\DAV\Tests\unit;
use OCA\DAV\Server;
use OCP\IRequest;
+use OCA\DAV\AppInfo\PluginManager;
/**
* Class ServerTest
@@ -38,8 +39,7 @@ class ServerTest extends \Test\TestCase {
public function test() {
/** @var IRequest $r */
- $r = $this->getMockBuilder('\OCP\IRequest')
- ->disableOriginalConstructor()->getMock();
+ $r = $this->createMock(IRequest::class);
$s = new Server($r, '/');
$this->assertInstanceOf('OCA\DAV\Server', $s);
}
diff --git a/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php b/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php
new file mode 100644
index 00000000000..8ee58107487
--- /dev/null
+++ b/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * @copyright 2017, Georg Ehrke <oc.list@georgehrke.com>
+ *
+ * @author Georg Ehrke <oc.list@georgehrke.com>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\DAV\Tests\Unit\DAV\Settings;
+
+use OCA\DAV\Settings\CalDAVSettings;
+use OCP\IConfig;
+use Test\TestCase;
+
+class CalDAVSettingsTest extends TestCase {
+
+ /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ private $config;
+
+ /** @var CalDAVSettings */
+ private $settings;
+
+ public function setUp() {
+ parent::setUp();
+
+ $this->config = $this->createMock(IConfig::class);
+ $this->settings = new CalDAVSettings($this->config);
+ }
+
+ public function testGetForm() {
+ $result = $this->settings->getForm();
+
+ $this->assertInstanceOf('OCP\AppFramework\Http\TemplateResponse', $result);
+ }
+
+ public function testGetSection() {
+ $this->assertEquals('additional', $this->settings->getSection());
+ }
+
+ public function testGetPriority() {
+ $this->assertEquals(20, $this->settings->getPriority());
+ }
+}
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
index 1831210546d..f67160af8d0 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
@@ -25,6 +25,9 @@
namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag;
+use OCP\IUser;
+use OCP\SystemTag\ISystemTagManager;
+use OCP\SystemTag\ISystemTagObjectMapper;
use OCP\SystemTag\TagNotFoundException;
use OCP\SystemTag\ISystemTag;
@@ -48,11 +51,11 @@ class SystemTagMappingNodeTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager')
+ $this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
->getMock();
- $this->tagMapper = $this->getMockBuilder('\OCP\SystemTag\ISystemTagObjectMapper')
+ $this->tagMapper = $this->getMockBuilder(ISystemTagObjectMapper::class)
->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..dd6892fe6ea 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
@@ -26,6 +26,8 @@ namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag;
+use OCP\IUser;
+use OCP\SystemTag\ISystemTagManager;
use OCP\SystemTag\TagNotFoundException;
use OCP\SystemTag\TagAlreadyExistsException;
use OCP\SystemTag\ISystemTag;
@@ -46,9 +48,9 @@ class SystemTagNodeTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager')
+ $this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
->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..b231577845c 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
@@ -27,11 +27,18 @@
namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag;
+use OCA\DAV\SystemTag\SystemTagNode;
+use OCA\DAV\SystemTag\SystemTagsByIdCollection;
+use OCA\DAV\SystemTag\SystemTagsObjectMappingCollection;
use OCP\IGroupManager;
use OCP\IUserSession;
+use OCP\SystemTag\ISystemTagManager;
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,19 +86,19 @@ 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();
$this->server = new \Sabre\DAV\Server($this->tree);
- $this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager')
+ $this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
->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())
@@ -189,7 +196,7 @@ class SystemTagPluginTest extends \Test\TestCase {
->with('admin')
->willReturn(true);
- $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode')
+ $node = $this->getMockBuilder(SystemTagNode::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
@@ -244,7 +251,7 @@ class SystemTagPluginTest extends \Test\TestCase {
->with('admin')
->willReturn(false);
- $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode')
+ $node = $this->getMockBuilder(SystemTagNode::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
@@ -279,7 +286,7 @@ class SystemTagPluginTest extends \Test\TestCase {
->with('admin')
->willReturn(true);
- $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode')
+ $node = $this->getMockBuilder(SystemTagNode::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
@@ -337,7 +344,7 @@ class SystemTagPluginTest extends \Test\TestCase {
->with('admin')
->willReturn(false);
- $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode')
+ $node = $this->getMockBuilder(SystemTagNode::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
@@ -400,7 +407,7 @@ class SystemTagPluginTest extends \Test\TestCase {
}
$requestData = json_encode($requestData);
- $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsByIdCollection')
+ $node = $this->getMockBuilder(SystemTagsByIdCollection::class)
->disableOriginalConstructor()
->getMock();
$this->tagManager->expects($this->never())
@@ -413,10 +420,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();
@@ -445,7 +452,7 @@ class SystemTagPluginTest extends \Test\TestCase {
'userAssignable' => true,
]);
- $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsByIdCollection')
+ $node = $this->getMockBuilder(SystemTagsByIdCollection::class)
->disableOriginalConstructor()
->getMock();
$this->tagManager->expects($this->once())
@@ -458,10 +465,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();
@@ -522,7 +529,7 @@ class SystemTagPluginTest extends \Test\TestCase {
}
$requestData = json_encode($requestData);
- $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsByIdCollection')
+ $node = $this->getMockBuilder(SystemTagsByIdCollection::class)
->disableOriginalConstructor()
->getMock();
$this->tagManager->expects($this->once())
@@ -545,10 +552,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();
@@ -601,7 +608,7 @@ class SystemTagPluginTest extends \Test\TestCase {
'userAssignable' => false,
]);
- $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection')
+ $node = $this->getMockBuilder(SystemTagsObjectMappingCollection::class)
->disableOriginalConstructor()
->getMock();
@@ -619,10 +626,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();
@@ -654,7 +661,7 @@ class SystemTagPluginTest extends \Test\TestCase {
* @expectedException \Sabre\DAV\Exception\NotFound
*/
public function testCreateTagToUnknownNode() {
- $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection')
+ $node = $this->getMockBuilder(SystemTagsObjectMappingCollection::class)
->disableOriginalConstructor()
->getMock();
@@ -668,10 +675,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 +722,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..ec52de0536a 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
@@ -26,6 +26,10 @@ namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag;
+use OCP\IGroupManager;
+use OCP\IUser;
+use OCP\IUserSession;
+use OCP\SystemTag\ISystemTagManager;
use OCP\SystemTag\TagNotFoundException;
class SystemTagsByIdCollectionTest extends \Test\TestCase {
@@ -43,22 +47,22 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager')
+ $this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
->getMock();
}
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..f99e4df1f69 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
@@ -26,6 +26,9 @@ namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag;
+use OCP\IUser;
+use OCP\SystemTag\ISystemTagManager;
+use OCP\SystemTag\ISystemTagObjectMapper;
use OCP\SystemTag\TagNotFoundException;
class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
@@ -48,12 +51,12 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager')
+ $this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
->getMock();
- $this->tagMapper = $this->getMockBuilder('\OCP\SystemTag\ISystemTagObjectMapper')
+ $this->tagMapper = $this->getMockBuilder(ISystemTagObjectMapper::class)
->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..0dc7ace2b89 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
@@ -24,6 +24,13 @@
namespace OCA\DAV\Tests\unit\SystemTag;
+use OCP\Files\Folder;
+use OCP\IGroupManager;
+use OCP\IUser;
+use OCP\IUserSession;
+use OCP\SystemTag\ISystemTagManager;
+use OCP\SystemTag\ISystemTagObjectMapper;
+
class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
/**
@@ -49,29 +56,29 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager')
+ $this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
->getMock();
- $this->tagMapper = $this->getMockBuilder('\OCP\SystemTag\ISystemTagObjectMapper')
+ $this->tagMapper = $this->getMockBuilder(ISystemTagObjectMapper::class)
->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/dav/tests/unit/Upload/AssemblyStreamTest.php b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php
index 69ee52299e9..0396f80c9f4 100644
--- a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php
+++ b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php
@@ -23,6 +23,8 @@
*/
namespace OCA\DAV\Tests\unit\Upload;
+use Sabre\DAV\File;
+
class AssemblyStreamTest extends \Test\TestCase {
/**
@@ -120,7 +122,7 @@ class AssemblyStreamTest extends \Test\TestCase {
}
private function buildNode($name, $data) {
- $node = $this->getMockBuilder('\Sabre\DAV\File')
+ $node = $this->getMockBuilder(File::class)
->setMethods(['getName', 'get', 'getSize'])
->getMockForAbstractClass();
diff --git a/apps/dav/tests/unit/Upload/FutureFileTest.php b/apps/dav/tests/unit/Upload/FutureFileTest.php
index d94f14ab097..10669912530 100644
--- a/apps/dav/tests/unit/Upload/FutureFileTest.php
+++ b/apps/dav/tests/unit/Upload/FutureFileTest.php
@@ -23,6 +23,8 @@
*/
namespace OCA\DAV\Tests\unit\Upload;
+use OCA\DAV\Connector\Sabre\Directory;
+
class FutureFileTest extends \Test\TestCase {
public function testGetContentType() {
@@ -57,7 +59,7 @@ class FutureFileTest extends \Test\TestCase {
}
public function testDelete() {
- $d = $this->getMockBuilder('OCA\DAV\Connector\Sabre\Directory')
+ $d = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->setMethods(['delete'])
->getMock();
@@ -89,7 +91,7 @@ class FutureFileTest extends \Test\TestCase {
* @return \OCA\DAV\Upload\FutureFile
*/
private function mockFutureFile() {
- $d = $this->getMockBuilder('OCA\DAV\Connector\Sabre\Directory')
+ $d = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->setMethods(['getETag', 'getLastModified', 'getChildren'])
->getMock();