summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Connector/Sabre
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-10-24 15:26:53 +0200
committerMorris Jobke <hey@morrisjobke.de>2017-10-24 17:45:32 +0200
commit43e498844e8c1aa519a19238d2cf3d6b95e1aab0 (patch)
tree59510ef2ffc6c1fd1fd92475013b108f1da2bfeb /apps/dav/tests/unit/Connector/Sabre
parentb1f77aca4effec99387481a831910d4870ae2ffc (diff)
downloadnextcloud-server-43e498844e8c1aa519a19238d2cf3d6b95e1aab0.tar.gz
nextcloud-server-43e498844e8c1aa519a19238d2cf3d6b95e1aab0.zip
Use ::class in test mocks
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/dav/tests/unit/Connector/Sabre')
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/AuthTest.php41
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php2
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php14
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php10
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php5
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php10
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FileTest.php34
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php24
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php54
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php2
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/NodeTest.php8
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php12
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php4
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php3
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php32
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php14
16 files changed, 157 insertions, 112 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
index dfcb7939799..34998745f77 100644
--- a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
@@ -34,6 +34,7 @@ use OC\User\Session;
use OCP\IRequest;
use OCP\ISession;
use OCP\IUser;
+use Sabre\DAV\Server;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
use Test\TestCase;
@@ -60,16 +61,16 @@ class AuthTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->session = $this->getMockBuilder('\OCP\ISession')
+ $this->session = $this->getMockBuilder(ISession::class)
->disableOriginalConstructor()->getMock();
- $this->userSession = $this->getMockBuilder('\OC\User\Session')
+ $this->userSession = $this->getMockBuilder(Session::class)
->disableOriginalConstructor()->getMock();
- $this->request = $this->getMockBuilder('\OCP\IRequest')
+ $this->request = $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()->getMock();
- $this->twoFactorManager = $this->getMockBuilder('\OC\Authentication\TwoFactorAuth\Manager')
+ $this->twoFactorManager = $this->getMockBuilder(Manager::class)
->disableOriginalConstructor()
->getMock();
- $this->throttler = $this->getMockBuilder('\OC\Security\Bruteforce\Throttler')
+ $this->throttler = $this->getMockBuilder(Throttler::class)
->disableOriginalConstructor()
->getMock();
$this->auth = new \OCA\DAV\Connector\Sabre\Auth(
@@ -112,7 +113,7 @@ class AuthTest extends TestCase {
}
public function testValidateUserPassOfAlreadyDAVAuthenticatedUser() {
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->exactly(2))
@@ -139,7 +140,7 @@ class AuthTest extends TestCase {
}
public function testValidateUserPassOfInvalidDAVAuthenticatedUser() {
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->once())
@@ -166,7 +167,7 @@ class AuthTest extends TestCase {
}
public function testValidateUserPassOfInvalidDAVAuthenticatedUserWithValidPassword() {
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->exactly(3))
@@ -258,7 +259,7 @@ class AuthTest extends TestCase {
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
->will($this->returnValue(null));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -310,7 +311,7 @@ class AuthTest extends TestCase {
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
->will($this->returnValue('LoggedInUser'));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -360,7 +361,7 @@ class AuthTest extends TestCase {
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
->will($this->returnValue('LoggedInUser'));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -414,7 +415,7 @@ class AuthTest extends TestCase {
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
->will($this->returnValue('AnotherUser'));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -460,7 +461,7 @@ class AuthTest extends TestCase {
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
->will($this->returnValue(null));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -494,7 +495,7 @@ class AuthTest extends TestCase {
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
->will($this->returnValue(null));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -529,7 +530,7 @@ class AuthTest extends TestCase {
->method('get')
->with('AUTHENTICATED_TO_DAV_BACKEND')
->will($this->returnValue(null));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -549,7 +550,7 @@ class AuthTest extends TestCase {
}
public function testAuthenticateNoBasicAuthenticateHeadersProvided() {
- $server = $this->getMockBuilder('\Sabre\DAV\Server')
+ $server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
$server->httpRequest = $this->getMockBuilder(RequestInterface::class)
@@ -597,7 +598,7 @@ class AuthTest extends TestCase {
->disableOriginalConstructor()
->getMock();
/** @var IUser */
- $user = $this->getMockBuilder('OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->method('getUID')->willReturn('MyTestUser');
@@ -630,7 +631,7 @@ class AuthTest extends TestCase {
}
public function testAuthenticateValidCredentials() {
- $server = $this->getMockBuilder('\Sabre\DAV\Server')
+ $server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
$server->httpRequest = $this->getMockBuilder(RequestInterface::class)
@@ -654,7 +655,7 @@ class AuthTest extends TestCase {
->method('logClientIn')
->with('username', 'password')
->will($this->returnValue(true));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->exactly(3))
@@ -669,7 +670,7 @@ class AuthTest extends TestCase {
}
public function testAuthenticateInvalidCredentials() {
- $server = $this->getMockBuilder('\Sabre\DAV\Server')
+ $server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
$server->httpRequest = $this->getMockBuilder(RequestInterface::class)
diff --git a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php
index eb1689089a4..e80d12979ed 100644
--- a/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php
@@ -44,7 +44,7 @@ class BlockLegacyClientPluginTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$this->blockLegacyClientVersionPlugin = new BlockLegacyClientPlugin($this->config);
diff --git a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
index 13e10476a41..c02bd5046d8 100644
--- a/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
@@ -25,6 +25,10 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre;
use \OCA\DAV\Connector\Sabre\CommentPropertiesPlugin as CommentPropertiesPluginImplementation;
+use OCA\DAV\Connector\Sabre\File;
+use OCP\Comments\ICommentsManager;
+use OCP\IUser;
+use OCP\IUserSession;
class CommentsPropertiesPluginTest extends \Test\TestCase {
@@ -37,10 +41,10 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->commentsManager = $this->getMockBuilder('\OCP\Comments\ICommentsManager')
+ $this->commentsManager = $this->getMockBuilder(ICommentsManager::class)
->disableOriginalConstructor()
->getMock();
- $this->userSession = $this->getMockBuilder('\OCP\IUserSession')
+ $this->userSession = $this->getMockBuilder(IUserSession::class)
->disableOriginalConstructor()
->getMock();
@@ -103,7 +107,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
* @param $expectedHref
*/
public function testGetCommentsLink($baseUri, $fid, $expectedHref) {
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $node = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
@@ -121,7 +125,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
public function userProvider() {
return [
[
- $this->getMockBuilder('\OCP\IUser')
+ $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock()
],
@@ -134,7 +138,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
* @param $user
*/
public function testGetUnreadCount($user) {
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $node = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
diff --git a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
index f0f4caa07a0..4f51c25741b 100644
--- a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
@@ -31,6 +31,10 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
* See the COPYING-README file.
*/
+use OCP\IUser;
+use Sabre\DAV\File;
+use Sabre\DAV\Tree;
+
/**
* Class CustomPropertiesBackend
*
@@ -63,13 +67,13 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
$this->server = new \Sabre\DAV\Server();
- $this->tree = $this->getMockBuilder('\Sabre\DAV\Tree')
+ $this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
->getMock();
$userId = $this->getUniqueID('testcustompropertiesuser');
- $this->user = $this->getMockBuilder('\OCP\IUser')
+ $this->user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$this->user->expects($this->any())
@@ -209,7 +213,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
public function testGetPropertiesForDirectory() {
$rootNode = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory');
- $nodeSub = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $nodeSub = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$nodeSub->expects($this->any())
diff --git a/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php b/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php
index 1c2e249e8c0..f16c374a0e1 100644
--- a/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php
@@ -26,6 +26,7 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin;
+use Sabre\DAV\Server;
use Test\TestCase;
/**
@@ -44,8 +45,8 @@ class DummyGetResponsePluginTest extends TestCase {
}
public function testInitialize() {
- /** @var \Sabre\DAV\Server $server */
- $server = $this->getMockBuilder('\Sabre\DAV\Server')
+ /** @var Server $server */
+ $server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
$server
diff --git a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
index abf6e5cf182..1fd2b05c23d 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
@@ -25,6 +25,8 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OCA\DAV\Connector\Sabre\FakeLockerPlugin;
+use Sabre\DAV\INode;
+use Sabre\DAV\Server;
use Sabre\HTTP\Response;
use Test\TestCase;
@@ -43,8 +45,8 @@ class FakeLockerPluginTest extends TestCase {
}
public function testInitialize() {
- /** @var \Sabre\DAV\Server $server */
- $server = $this->getMockBuilder('\Sabre\DAV\Server')
+ /** @var Server $server */
+ $server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
$server
@@ -86,7 +88,7 @@ class FakeLockerPluginTest extends TestCase {
$propFind = $this->getMockBuilder('\Sabre\DAV\PropFind')
->disableOriginalConstructor()
->getMock();
- $node = $this->getMockBuilder('\Sabre\DAV\INode')
+ $node = $this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock();
@@ -155,7 +157,7 @@ class FakeLockerPluginTest extends TestCase {
->disableOriginalConstructor()
->getMock();
$response = new Response();
- $server = $this->getMockBuilder('\Sabre\DAV\Server')
+ $server = $this->getMockBuilder(Server::class)
->getMock();
$this->fakeLockerPlugin->initialize($server);
diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
index e2666d0de27..3a2075941ae 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
@@ -27,7 +27,9 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OC\Files\Storage\Local;
+use OC\Files\View;
use OCP\Files\ForbiddenException;
+use OCP\Files\Storage;
use Test\HookHelper;
use OC\Files\Filesystem;
use OCP\Lock\ILockingProvider;
@@ -70,7 +72,7 @@ class FileTest extends \Test\TestCase {
}
private function getMockStorage() {
- $storage = $this->getMockBuilder('\OCP\Files\Storage')
+ $storage = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()
->getMock();
$storage->expects($this->any())
@@ -151,12 +153,12 @@ class FileTest extends \Test\TestCase {
*/
public function testSimplePutFails($thrownException, $expectedException, $checkPreviousClass = true) {
// setup
- $storage = $this->getMockBuilder('\OC\Files\Storage\Local')
+ $storage = $this->getMockBuilder(Local::class)
->setMethods(['fopen'])
->setConstructorArgs([['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]])
->getMock();
\OC\Files\Filesystem::mount($storage, [], $this->user . '/');
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['getRelativePath', 'resolvePath'])
->getMock();
$view->expects($this->atLeastOnce())
@@ -210,12 +212,12 @@ class FileTest extends \Test\TestCase {
*/
public function testChunkedPutFails($thrownException, $expectedException, $checkPreviousClass = false) {
// setup
- $storage = $this->getMockBuilder('\OC\Files\Storage\Local')
+ $storage = $this->getMockBuilder(Local::class)
->setMethods(['fopen'])
->setConstructorArgs([['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]])
->getMock();
\OC\Files\Filesystem::mount($storage, [], $this->user . '/');
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['getRelativePath', 'resolvePath'])
->getMock();
$view->expects($this->atLeastOnce())
@@ -535,7 +537,7 @@ class FileTest extends \Test\TestCase {
*/
public function testSimplePutFailsSizeCheck() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['rename', 'getRelativePath', 'filesize'])
->getMock();
$view->expects($this->any())
@@ -653,7 +655,7 @@ class FileTest extends \Test\TestCase {
*/
public function testSimplePutInvalidChars() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['getRelativePath'])
->getMock();
$view->expects($this->any())
@@ -690,7 +692,7 @@ class FileTest extends \Test\TestCase {
*/
public function testSetNameInvalidChars() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['getRelativePath'])
->getMock();
@@ -709,7 +711,7 @@ class FileTest extends \Test\TestCase {
*/
public function testUploadAbort() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['rename', 'getRelativePath', 'filesize'])
->getMock();
$view->expects($this->any())
@@ -755,7 +757,7 @@ class FileTest extends \Test\TestCase {
*/
public function testDeleteWhenAllowed() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->getMock();
$view->expects($this->once())
@@ -777,7 +779,7 @@ class FileTest extends \Test\TestCase {
*/
public function testDeleteThrowsWhenDeletionNotAllowed() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->getMock();
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array(
@@ -795,7 +797,7 @@ class FileTest extends \Test\TestCase {
*/
public function testDeleteThrowsWhenDeletionFailed() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->getMock();
// but fails
@@ -818,7 +820,7 @@ class FileTest extends \Test\TestCase {
*/
public function testDeleteThrowsWhenDeletionThrows() {
// setup
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->getMock();
// but fails
@@ -968,7 +970,7 @@ class FileTest extends \Test\TestCase {
* @expectedException \Sabre\DAV\Exception\ServiceUnavailable
*/
public function testGetFopenFails() {
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['fopen'])
->getMock();
$view->expects($this->atLeastOnce())
@@ -988,7 +990,7 @@ class FileTest extends \Test\TestCase {
* @expectedException \OCA\DAV\Connector\Sabre\Exception\Forbidden
*/
public function testGetFopenThrows() {
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['fopen'])
->getMock();
$view->expects($this->atLeastOnce())
@@ -1008,7 +1010,7 @@ class FileTest extends \Test\TestCase {
* @expectedException \Sabre\DAV\Exception\NotFound
*/
public function testGetThrowsIfNoPermission() {
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['fopen'])
->getMock();
$view->expects($this->never())
diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
index 885f3c23c24..a33ece3c4b3 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
@@ -25,10 +25,16 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OCA\DAV\Connector\Sabre\File;
use OCA\DAV\Connector\Sabre\FilesPlugin;
use OCP\Files\StorageNotAvailableException;
+use OCP\IConfig;
+use OCP\IPreview;
+use OCP\IRequest;
use Sabre\DAV\PropFind;
use Sabre\DAV\PropPatch;
+use Sabre\DAV\Server;
+use Sabre\DAV\Tree;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
use Test\TestCase;
@@ -87,20 +93,20 @@ class FilesPluginTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->server = $this->getMockBuilder('\Sabre\DAV\Server')
+ $this->server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
->getMock();
- $this->tree = $this->getMockBuilder('\Sabre\DAV\Tree')
+ $this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
->getMock();
- $this->config = $this->createMock('\OCP\IConfig');
+ $this->config = $this->createMock(IConfig::class);
$this->config->expects($this->any())->method('getSystemValue')
->with($this->equalTo('data-fingerprint'), $this->equalTo(''))
->willReturn('my_fingerprint');
- $this->request = $this->getMockBuilder('\OCP\IRequest')
+ $this->request = $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock();
- $this->previewManager = $this->getMockBuilder('\OCP\IPreview')
+ $this->previewManager = $this->getMockBuilder(IPreview::class)
->disableOriginalConstructor()
->getMock();
@@ -245,7 +251,7 @@ class FilesPluginTest extends TestCase {
$this->plugin = new FilesPlugin(
$this->tree,
$this->config,
- $this->getMockBuilder('\OCP\IRequest')
+ $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock(),
$this->previewManager,
@@ -311,7 +317,7 @@ class FilesPluginTest extends TestCase {
public function testGetPropertiesForRootDirectory() {
/** @var \OCA\DAV\Connector\Sabre\Directory | \PHPUnit_Framework_MockObject_MockObject $node */
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $node = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())->method('getPath')->willReturn('/');
@@ -347,7 +353,7 @@ class FilesPluginTest extends TestCase {
// $this->expectException(\Sabre\DAV\Exception\NotFound::class);
/** @var \OCA\DAV\Connector\Sabre\Directory|\PHPUnit_Framework_MockObject_MockObject $node */
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $node = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())->method('getPath')->willReturn('/');
@@ -539,7 +545,7 @@ class FilesPluginTest extends TestCase {
->method('getPath')
->will($this->returnValue('test/somefile.xml'));
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $node = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node
diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
index 3ca131dbf6f..374557c6b67 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
@@ -24,9 +24,14 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\FilesReportPlugin as FilesReportPluginImplementation;
+use OCP\Files\File;
+use OCP\IConfig;
use OCP\IPreview;
+use OCP\IRequest;
use OCP\ITagManager;
+use OCP\IUser;
use OCP\IUserSession;
use OCP\SystemTag\ISystemTagObjectMapper;
use OC\Files\View;
@@ -35,6 +40,9 @@ use OCP\IGroupManager;
use OCP\SystemTag\ISystemTagManager;
use OCP\ITags;
use OCP\Files\FileInfo;
+use Sabre\DAV\INode;
+use Sabre\DAV\Tree;
+use Sabre\HTTP\ResponseInterface;
class FilesReportPluginTest extends \Test\TestCase {
/** @var \Sabre\DAV\Server|\PHPUnit_Framework_MockObject_MockObject */
@@ -72,11 +80,11 @@ class FilesReportPluginTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->tree = $this->getMockBuilder('\Sabre\DAV\Tree')
+ $this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
->getMock();
- $this->view = $this->getMockBuilder('\OC\Files\View')
+ $this->view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
@@ -89,15 +97,15 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('getBaseUri')
->will($this->returnValue('http://example.com/owncloud/remote.php/dav'));
- $this->groupManager = $this->getMockBuilder('\OCP\IGroupManager')
+ $this->groupManager = $this->getMockBuilder(IGroupManager::class)
->disableOriginalConstructor()
->getMock();
- $this->userFolder = $this->getMockBuilder('\OCP\Files\Folder')
+ $this->userFolder = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
- $this->previewManager = $this->getMockBuilder('\OCP\IPreview')
+ $this->previewManager = $this->getMockBuilder(IPreview::class)
->disableOriginalConstructor()
->getMock();
@@ -111,7 +119,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->with('files')
->will($this->returnValue($this->privateTags));
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->any())
@@ -140,7 +148,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('getNodeForPath')
->with('/' . $path)
->will($this->returnValue(
- $this->getMockBuilder('\Sabre\DAV\INode')
+ $this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock()
));
@@ -160,7 +168,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('getNodeForPath')
->with('/' . $path)
->will($this->returnValue(
- $this->getMockBuilder('\Sabre\DAV\INode')
+ $this->getMockBuilder(INode::class)
->disableOriginalConstructor()
->getMock()
));
@@ -206,11 +214,11 @@ class FilesReportPluginTest extends \Test\TestCase {
->with('456', 'files')
->will($this->returnValue(['111', '222', '333']));
- $reportTargetNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $reportTargetNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
- $response = $this->getMockBuilder('Sabre\HTTP\ResponseInterface')
+ $response = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
->getMock();
@@ -230,10 +238,10 @@ class FilesReportPluginTest extends \Test\TestCase {
->with('/' . $path)
->will($this->returnValue($reportTargetNode));
- $filesNode1 = $this->getMockBuilder('\OCP\Files\Folder')
+ $filesNode1 = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
- $filesNode2 = $this->getMockBuilder('\OCP\Files\File')
+ $filesNode2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
@@ -256,21 +264,21 @@ class FilesReportPluginTest extends \Test\TestCase {
}
public function testFindNodesByFileIdsRoot() {
- $filesNode1 = $this->getMockBuilder('\OCP\Files\Folder')
+ $filesNode1 = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
$filesNode1->expects($this->once())
->method('getName')
->will($this->returnValue('first node'));
- $filesNode2 = $this->getMockBuilder('\OCP\Files\File')
+ $filesNode2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$filesNode2->expects($this->once())
->method('getName')
->will($this->returnValue('second node'));
- $reportTargetNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $reportTargetNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$reportTargetNode->expects($this->any())
@@ -297,21 +305,21 @@ class FilesReportPluginTest extends \Test\TestCase {
}
public function testFindNodesByFileIdsSubDir() {
- $filesNode1 = $this->getMockBuilder('\OCP\Files\Folder')
+ $filesNode1 = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
$filesNode1->expects($this->once())
->method('getName')
->will($this->returnValue('first node'));
- $filesNode2 = $this->getMockBuilder('\OCP\Files\File')
+ $filesNode2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$filesNode2->expects($this->once())
->method('getName')
->will($this->returnValue('second node'));
- $reportTargetNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $reportTargetNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$reportTargetNode->expects($this->any())
@@ -319,7 +327,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->will($this->returnValue('/sub1/sub2'));
- $subNode = $this->getMockBuilder('\OCP\Files\Folder')
+ $subNode = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
@@ -353,10 +361,10 @@ class FilesReportPluginTest extends \Test\TestCase {
$fileInfo = $this->createMock(FileInfo::class);
$fileInfo->method('isReadable')->willReturn(true);
- $node1 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $node1 = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
- $node2 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $node2 = $this->getMockBuilder(\OCA\DAV\Connector\Sabre\File::class)
->disableOriginalConstructor()
->getMock();
@@ -378,7 +386,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->will($this->returnValue('/sub/node2'));
$node2->method('getFileInfo')->willReturn($fileInfo);
- $config = $this->getMockBuilder('\OCP\IConfig')
+ $config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
@@ -386,7 +394,7 @@ class FilesReportPluginTest extends \Test\TestCase {
new \OCA\DAV\Connector\Sabre\FilesPlugin(
$this->tree,
$config,
- $this->getMockBuilder('\OCP\IRequest')
+ $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock(),
$this->previewManager
diff --git a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php
index 43c32299523..b028cb8e6ac 100644
--- a/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php
@@ -42,7 +42,7 @@ class MaintenancePluginTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->maintenancePlugin = new MaintenancePlugin($this->config);
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
index 0aa3fe6101d..e7ab94ac926 100644
--- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
@@ -25,6 +25,8 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OC\Files\View;
+use OCP\Files\Storage;
/**
* Class NodeTest
@@ -67,7 +69,7 @@ class NodeTest extends \Test\TestCase {
$info->expects($this->any())
->method('getType')
->will($this->returnValue($type));
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
@@ -119,7 +121,7 @@ class NodeTest extends \Test\TestCase {
* @dataProvider sharePermissionsProvider
*/
public function testSharePermissions($type, $user, $permissions, $expected) {
- $storage = $this->getMockBuilder('\OCP\Files\Storage')
+ $storage = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()
->getMock();
$storage->method('getPermissions')->willReturn($permissions);
@@ -149,7 +151,7 @@ class NodeTest extends \Test\TestCase {
$info->method('getType')->willReturn($type);
$info->method('getMountPoint')->willReturn($mountpoint);
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
index 53f60bd0f1c..c9c55adc9e8 100644
--- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
@@ -156,13 +156,13 @@ class ObjectTreeTest extends \Test\TestCase {
$_SERVER['HTTP_OC_CHUNKED'] = true;
}
- $rootNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $rootNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager')
->disableOriginalConstructor()
->getMock();
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
$fileInfo = $this->getMockBuilder('\OCP\Files\FileInfo')
@@ -275,7 +275,7 @@ class ObjectTreeTest extends \Test\TestCase {
$storage = new Temporary([]);
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['resolvePath'])
->getMock();
$view->expects($this->once())
@@ -284,7 +284,7 @@ class ObjectTreeTest extends \Test\TestCase {
return [$storage, ltrim($path, '/')];
}));
- $rootNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $rootNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager')
@@ -302,7 +302,7 @@ class ObjectTreeTest extends \Test\TestCase {
$storage = new Temporary([]);
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->setMethods(['resolvePath'])
->getMock();
$view->expects($this->any())
@@ -311,7 +311,7 @@ class ObjectTreeTest extends \Test\TestCase {
return [$storage, ltrim($path, '/')];
}));
- $rootNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $rootNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager')
diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php
index 3f3bf16a422..ec4652a3af2 100644
--- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php
@@ -24,6 +24,8 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
+use OCP\IConfig;
+
/**
* Class PartFileInRootUploadTest
*
@@ -34,7 +36,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
class PartFileInRootUploadTest extends UploadTest {
protected function setUp() {
$config = \OC::$server->getConfig();
- $mockConfig = $this->getMockBuilder('\OCP\IConfig')
+ $mockConfig = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$mockConfig->expects($this->any())
diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php
index 58a729e18ec..aec467dd50a 100644
--- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php
+++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php
@@ -29,6 +29,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
use OCA\DAV\Connector\Sabre\Server;
use OCA\DAV\Connector\Sabre\ServerFactory;
use OC\Files\View;
+use OCP\IRequest;
use Sabre\HTTP\Request;
use Test\TestCase;
use Test\Traits\MountProviderTrait;
@@ -62,7 +63,7 @@ abstract class RequestTestCase extends TestCase {
\OC::$server->getUserSession(),
\OC::$server->getMountManager(),
\OC::$server->getTagManager(),
- $this->getMockBuilder('\OCP\IRequest')
+ $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock(),
\OC::$server->getPreviewManager()
diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
index 2b4a886050a..7c735ca2334 100644
--- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
@@ -23,6 +23,14 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Connector\Sabre\File;
+use OCP\Files\Folder;
+use OCP\IUser;
+use OCP\IUserSession;
+use OCP\Share\IManager;
+use Sabre\DAV\Tree;
+
class SharesPluginTest extends \Test\TestCase {
const SHARETYPES_PROPERTYNAME = \OCA\DAV\Connector\Sabre\SharesPlugin::SHARETYPES_PROPERTYNAME;
@@ -55,26 +63,26 @@ class SharesPluginTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
$this->server = new \Sabre\DAV\Server();
- $this->tree = $this->getMockBuilder('\Sabre\DAV\Tree')
+ $this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
->getMock();
- $this->shareManager = $this->getMockBuilder('\OCP\Share\IManager')
+ $this->shareManager = $this->getMockBuilder(IManager::class)
->disableOriginalConstructor()
->getMock();
- $user = $this->getMockBuilder('\OCP\IUser')
+ $user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$user->expects($this->once())
->method('getUID')
->will($this->returnValue('user1'));
- $userSession = $this->getMockBuilder('\OCP\IUserSession')
+ $userSession = $this->getMockBuilder(IUserSession::class)
->disableOriginalConstructor()
->getMock();
$userSession->expects($this->once())
->method('getUser')
->will($this->returnValue($user));
- $this->userFolder = $this->getMockBuilder('\OCP\Files\Folder')
+ $this->userFolder = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
@@ -102,7 +110,7 @@ class SharesPluginTest extends \Test\TestCase {
->will($this->returnValue('/subdir'));
// node API nodes
- $node = $this->getMockBuilder('\OCP\Files\Folder')
+ $node = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
@@ -149,7 +157,7 @@ class SharesPluginTest extends \Test\TestCase {
* @dataProvider sharesGetPropertiesDataProvider
*/
public function testPreloadThenGetProperties($shareTypes) {
- $sabreNode1 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $sabreNode1 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$sabreNode1->expects($this->any())
@@ -157,7 +165,7 @@ class SharesPluginTest extends \Test\TestCase {
->will($this->returnValue(111));
$sabreNode1->expects($this->any())
->method('getPath');
- $sabreNode2 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $sabreNode2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$sabreNode2->expects($this->any())
@@ -167,7 +175,7 @@ class SharesPluginTest extends \Test\TestCase {
->method('getPath')
->will($this->returnValue('/subdir/foo'));
- $sabreNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $sabreNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$sabreNode->expects($this->any())
@@ -181,19 +189,19 @@ class SharesPluginTest extends \Test\TestCase {
->will($this->returnValue('/subdir'));
// node API nodes
- $node = $this->getMockBuilder('\OCP\Files\Folder')
+ $node = $this->getMockBuilder(Folder::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())
->method('getId')
->will($this->returnValue(123));
- $node1 = $this->getMockBuilder('\OCP\Files\File')
+ $node1 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node1->expects($this->any())
->method('getId')
->will($this->returnValue(111));
- $node2 = $this->getMockBuilder('\OCP\Files\File')
+ $node2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node2->expects($this->any())
diff --git a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
index 9189a73f77f..48d02cad690 100644
--- a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
@@ -24,6 +24,10 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Connector\Sabre\File;
+use Sabre\DAV\Tree;
+
/**
* Copyright (c) 2014 Vincent Petry <pvince81@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
@@ -42,7 +46,7 @@ class TagsPluginTest extends \Test\TestCase {
private $server;
/**
- * @var \Sabre\DAV\Tree
+ * @var Tree
*/
private $tree;
@@ -64,7 +68,7 @@ class TagsPluginTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
$this->server = new \Sabre\DAV\Server();
- $this->tree = $this->getMockBuilder('\Sabre\DAV\Tree')
+ $this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
->getMock();
$this->tagger = $this->getMockBuilder('\OCP\ITags')
@@ -124,13 +128,13 @@ class TagsPluginTest extends \Test\TestCase {
* @dataProvider tagsGetPropertiesDataProvider
*/
public function testPreloadThenGetProperties($tags, $requestedProperties, $expectedProperties) {
- $node1 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $node1 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node1->expects($this->any())
->method('getId')
->will($this->returnValue(111));
- $node2 = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\File')
+ $node2 = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
->getMock();
$node2->expects($this->any())
@@ -145,7 +149,7 @@ class TagsPluginTest extends \Test\TestCase {
$expectedCallCount = 1;
}
- $node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Directory')
+ $node = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
$node->expects($this->any())