aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-10-10 12:40:31 +0200
committerCôme Chilliet <come.chilliet@nextcloud.com>2024-10-15 10:40:25 +0200
commit1580c8612b01bfa780d1a7372080a27d182fb7dd (patch)
treeb2776d0cd254ac9d6e54828978ce18b702f550d5 /apps/dav/tests
parent4ff9b3e0ce53227e2be47c4c2dcb1fdc3e540b5f (diff)
downloadnextcloud-server-1580c8612b01bfa780d1a7372080a27d182fb7dd.tar.gz
nextcloud-server-1580c8612b01bfa780d1a7372080a27d182fb7dd.zip
chore(apps): Apply new rector configuration to autouse classes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/dav/tests')
-rw-r--r--apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php5
-rw-r--r--apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php2
-rw-r--r--apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php2
-rw-r--r--apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php3
-rw-r--r--apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php4
-rw-r--r--apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php4
-rw-r--r--apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php2
-rw-r--r--apps/dav/tests/unit/Command/ListAddressbooksTest.php2
-rw-r--r--apps/dav/tests/unit/Comments/EntityCollectionTest.php14
-rw-r--r--apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php5
-rw-r--r--apps/dav/tests/unit/Comments/RootCollectionTest.php5
-rw-r--r--apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php5
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/AuthTest.php11
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php3
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php5
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php16
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FileTest.php151
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php15
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php7
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/NodeTest.php13
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php21
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php3
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php2
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php4
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php2
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php7
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php22
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php3
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php3
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php17
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php3
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php3
-rw-r--r--apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php10
-rw-r--r--apps/dav/tests/unit/Upload/AssemblyStreamTest.php7
-rw-r--r--apps/dav/tests/unit/Upload/FutureFileTest.php7
35 files changed, 219 insertions, 169 deletions
diff --git a/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php b/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
index 85000aba6d3..21e999d34be 100644
--- a/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php
@@ -10,6 +10,7 @@ namespace OCA\DAV\Tests\unit\BackgroundJob;
use OCA\DAV\BackgroundJob\CleanupInvitationTokenJob;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\DB\QueryBuilder\IExpressionBuilder;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use Test\TestCase;
@@ -21,7 +22,7 @@ class CleanupInvitationTokenJobTest extends TestCase {
/** @var ITimeFactory | \PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
- /** @var \OCA\DAV\BackgroundJob\CleanupInvitationTokenJob */
+ /** @var CleanupInvitationTokenJob */
private $backgroundJob;
protected function setUp(): void {
@@ -41,7 +42,7 @@ class CleanupInvitationTokenJobTest extends TestCase {
->willReturn(1337);
$queryBuilder = $this->createMock(IQueryBuilder::class);
- $expr = $this->createMock(\OCP\DB\QueryBuilder\IExpressionBuilder::class);
+ $expr = $this->createMock(IExpressionBuilder::class);
$stmt = $this->createMock(\Doctrine\DBAL\Driver\Statement::class);
$this->dbConnection->expects($this->once())
diff --git a/apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php b/apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php
index 4874e79b9a2..82d2251f17a 100644
--- a/apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/GenerateBirthdayCalendarBackgroundJobTest.php
@@ -26,7 +26,7 @@ class GenerateBirthdayCalendarBackgroundJobTest extends TestCase {
/** @var IConfig | MockObject */
private $config;
- /** @var \OCA\DAV\BackgroundJob\GenerateBirthdayCalendarBackgroundJob */
+ /** @var GenerateBirthdayCalendarBackgroundJob */
private $backgroundJob;
protected function setUp(): void {
diff --git a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
index 89ef73ec134..f895deb7fd1 100644
--- a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
@@ -27,7 +27,7 @@ class EnablePluginTest extends TestCase {
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject */
protected $user;
- /** @var \OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin $plugin */
+ /** @var EnablePlugin $plugin */
protected $plugin;
protected $request;
diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
index 708581f9b6d..42eb0b0faa3 100644
--- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
+++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
@@ -14,6 +14,7 @@ use OCP\IUser;
use OCP\Mail\IEMailTemplate;
use OCP\Mail\IMailer;
use OCP\Mail\IMessage;
+use OCP\Util;
use PHPUnit\Framework\MockObject\MockObject;
use Sabre\VObject\Component\VCalendar;
@@ -350,7 +351,7 @@ class EmailProviderTest extends AbstractNotificationProviderTest {
$message->expects($this->once())
->method('setFrom')
- ->with([\OCP\Util::getDefaultEmailAddress('reminders-noreply')])
+ ->with([Util::getDefaultEmailAddress('reminders-noreply')])
->willReturn($message);
if ($replyTo) {
diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php
index 98d49552b02..bdb318ee32f 100644
--- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php
+++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php
@@ -36,7 +36,7 @@ class NotificationProviderManagerTest extends TestCase {
* @throws NotificationTypeDoesNotExistException
*/
public function testGetProviderForUnknownType(): void {
- $this->expectException(\OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException::class);
+ $this->expectException(NotificationTypeDoesNotExistException::class);
$this->expectExceptionMessage('Type NOT EXISTENT is not an accepted type of notification');
$this->providerManager->getProvider('NOT EXISTENT');
@@ -47,7 +47,7 @@ class NotificationProviderManagerTest extends TestCase {
* @throws ProviderNotAvailableException
*/
public function testGetProviderForUnRegisteredType(): void {
- $this->expectException(\OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException::class);
+ $this->expectException(ProviderNotAvailableException::class);
$this->expectExceptionMessage('No notification provider for type AUDIO available');
$this->providerManager->getProvider('AUDIO');
diff --git a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
index ed39129fa56..b2fd9cfb93f 100644
--- a/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
+++ b/apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
@@ -7,6 +7,8 @@ namespace OCA\DAV\Tests\unit\CalDAV\ResourceBooking;
use OCA\DAV\CalDAV\Proxy\Proxy;
use OCA\DAV\CalDAV\Proxy\ProxyMapper;
+use OCA\DAV\CalDAV\ResourceBooking\ResourcePrincipalBackend;
+use OCA\DAV\CalDAV\ResourceBooking\RoomPrincipalBackend;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserSession;
@@ -15,7 +17,7 @@ use Sabre\DAV\PropPatch;
use Test\TestCase;
abstract class AbstractPrincipalBackendTest extends TestCase {
- /** @var \OCA\DAV\CalDAV\ResourceBooking\ResourcePrincipalBackend|\OCA\DAV\CalDAV\ResourceBooking\RoomPrincipalBackend */
+ /** @var ResourcePrincipalBackend|RoomPrincipalBackend */
protected $principalBackend;
/** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
diff --git a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php
index ae4519e2542..0da971dc36b 100644
--- a/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php
+++ b/apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php
@@ -14,7 +14,7 @@ use Test\TestCase;
class SearchPluginTest extends TestCase {
protected $server;
- /** @var \OCA\DAV\CalDAV\Search\SearchPlugin $plugin */
+ /** @var SearchPlugin $plugin */
protected $plugin;
protected function setUp(): void {
diff --git a/apps/dav/tests/unit/Command/ListAddressbooksTest.php b/apps/dav/tests/unit/Command/ListAddressbooksTest.php
index b6a8c25477c..2c6b1579042 100644
--- a/apps/dav/tests/unit/Command/ListAddressbooksTest.php
+++ b/apps/dav/tests/unit/Command/ListAddressbooksTest.php
@@ -21,7 +21,7 @@ use Test\TestCase;
*/
class ListAddressbooksTest extends TestCase {
- private \OCP\IUserManager|MockObject $userManager;
+ private IUserManager|MockObject $userManager;
private CardDavBackend|MockObject $cardDavBackend;
private ListAddressbooks $command;
diff --git a/apps/dav/tests/unit/Comments/EntityCollectionTest.php b/apps/dav/tests/unit/Comments/EntityCollectionTest.php
index 0d4adae250e..6996022b607 100644
--- a/apps/dav/tests/unit/Comments/EntityCollectionTest.php
+++ b/apps/dav/tests/unit/Comments/EntityCollectionTest.php
@@ -7,9 +7,11 @@
*/
namespace OCA\DAV\Tests\unit\Comments;
+use OCA\DAV\Comments\CommentNode;
use OCA\DAV\Comments\EntityCollection;
use OCP\Comments\IComment;
use OCP\Comments\ICommentsManager;
+use OCP\Comments\NotFoundException;
use OCP\IUserManager;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;
@@ -43,7 +45,7 @@ class EntityCollectionTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
- $this->collection = new \OCA\DAV\Comments\EntityCollection(
+ $this->collection = new EntityCollection(
'19',
'files',
$this->commentsManager,
@@ -68,7 +70,7 @@ class EntityCollectionTest extends \Test\TestCase {
);
$node = $this->collection->getChild('55');
- $this->assertTrue($node instanceof \OCA\DAV\Comments\CommentNode);
+ $this->assertTrue($node instanceof CommentNode);
}
@@ -78,7 +80,7 @@ class EntityCollectionTest extends \Test\TestCase {
$this->commentsManager->expects($this->once())
->method('get')
->with('55')
- ->will($this->throwException(new \OCP\Comments\NotFoundException()));
+ ->will($this->throwException(new NotFoundException()));
$this->collection->getChild('55');
}
@@ -96,7 +98,7 @@ class EntityCollectionTest extends \Test\TestCase {
$result = $this->collection->getChildren();
$this->assertSame(count($result), 1);
- $this->assertTrue($result[0] instanceof \OCA\DAV\Comments\CommentNode);
+ $this->assertTrue($result[0] instanceof CommentNode);
}
public function testFindChildren(): void {
@@ -113,7 +115,7 @@ class EntityCollectionTest extends \Test\TestCase {
$result = $this->collection->findChildren(5, 15, $dt);
$this->assertSame(count($result), 1);
- $this->assertTrue($result[0] instanceof \OCA\DAV\Comments\CommentNode);
+ $this->assertTrue($result[0] instanceof CommentNode);
}
public function testChildExistsTrue(): void {
@@ -124,7 +126,7 @@ class EntityCollectionTest extends \Test\TestCase {
$this->commentsManager->expects($this->once())
->method('get')
->with('44')
- ->will($this->throwException(new \OCP\Comments\NotFoundException()));
+ ->will($this->throwException(new NotFoundException()));
$this->assertFalse($this->collection->childExists('44'));
}
diff --git a/apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php b/apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php
index 5ab9c38ecd0..15b8073481c 100644
--- a/apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php
+++ b/apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php
@@ -8,6 +8,7 @@
namespace OCA\DAV\Tests\unit\Comments;
use OCA\DAV\Comments\EntityCollection as EntityCollectionImplemantation;
+use OCA\DAV\Comments\EntityTypeCollection;
use OCP\Comments\ICommentsManager;
use OCP\IUserManager;
use OCP\IUserSession;
@@ -21,7 +22,7 @@ class EntityTypeCollectionTest extends \Test\TestCase {
protected $userManager;
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
- /** @var \OCA\DAV\Comments\EntityTypeCollection */
+ /** @var EntityTypeCollection */
protected $collection;
/** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
protected $userSession;
@@ -46,7 +47,7 @@ class EntityTypeCollectionTest extends \Test\TestCase {
$instance = $this;
- $this->collection = new \OCA\DAV\Comments\EntityTypeCollection(
+ $this->collection = new EntityTypeCollection(
'files',
$this->commentsManager,
$this->userManager,
diff --git a/apps/dav/tests/unit/Comments/RootCollectionTest.php b/apps/dav/tests/unit/Comments/RootCollectionTest.php
index 6da96be5818..8f58e5c3c5f 100644
--- a/apps/dav/tests/unit/Comments/RootCollectionTest.php
+++ b/apps/dav/tests/unit/Comments/RootCollectionTest.php
@@ -9,6 +9,7 @@ namespace OCA\DAV\Tests\unit\Comments;
use OC\EventDispatcher\EventDispatcher;
use OCA\DAV\Comments\EntityTypeCollection as EntityTypeCollectionImplementation;
+use OCA\DAV\Comments\RootCollection;
use OCP\Comments\CommentsEntityEvent;
use OCP\Comments\ICommentsManager;
use OCP\EventDispatcher\IEventDispatcher;
@@ -25,7 +26,7 @@ class RootCollectionTest extends \Test\TestCase {
protected $userManager;
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
- /** @var \OCA\DAV\Comments\RootCollection */
+ /** @var RootCollection */
protected $collection;
/** @var \OCP\IUserSession|\PHPUnit\Framework\MockObject\MockObject */
protected $userSession;
@@ -59,7 +60,7 @@ class RootCollectionTest extends \Test\TestCase {
$this->logger
);
- $this->collection = new \OCA\DAV\Comments\RootCollection(
+ $this->collection = new RootCollection(
$this->commentsManager,
$this->userManager,
$this->userSession,
diff --git a/apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php b/apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php
index 4f3581d6071..2bb68374162 100644
--- a/apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php
+++ b/apps/dav/tests/unit/Connector/LegacyPublicAuthTest.php
@@ -7,6 +7,7 @@
*/
namespace OCA\DAV\Tests\unit\Connector;
+use OCA\DAV\Connector\LegacyPublicAuth;
use OCP\IRequest;
use OCP\ISession;
use OCP\Security\Bruteforce\IThrottler;
@@ -29,7 +30,7 @@ class LegacyPublicAuthTest extends \Test\TestCase {
private $request;
/** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
private $shareManager;
- /** @var \OCA\DAV\Connector\LegacyPublicAuth */
+ /** @var LegacyPublicAuth */
private $auth;
/** @var IThrottler|\PHPUnit\Framework\MockObject\MockObject */
private $throttler;
@@ -53,7 +54,7 @@ class LegacyPublicAuthTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
- $this->auth = new \OCA\DAV\Connector\LegacyPublicAuth(
+ $this->auth = new LegacyPublicAuth(
$this->request,
$this->shareManager,
$this->session,
diff --git a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
index de258c9aaec..c6d247b3951 100644
--- a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php
@@ -7,8 +7,11 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OC\Authentication\Exceptions\PasswordLoginForbiddenException;
use OC\Authentication\TwoFactorAuth\Manager;
use OC\User\Session;
+use OCA\DAV\Connector\Sabre\Auth;
+use OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden;
use OCP\IRequest;
use OCP\ISession;
use OCP\IUser;
@@ -28,7 +31,7 @@ use Test\TestCase;
class AuthTest extends TestCase {
/** @var ISession&MockObject */
private $session;
- /** @var \OCA\DAV\Connector\Sabre\Auth */
+ /** @var Auth */
private $auth;
/** @var Session&MockObject */
private $userSession;
@@ -53,7 +56,7 @@ class AuthTest extends TestCase {
$this->throttler = $this->getMockBuilder(IThrottler::class)
->disableOriginalConstructor()
->getMock();
- $this->auth = new \OCA\DAV\Connector\Sabre\Auth(
+ $this->auth = new Auth(
$this->session,
$this->userSession,
$this->request,
@@ -201,7 +204,7 @@ class AuthTest extends TestCase {
public function testValidateUserPassWithPasswordLoginForbidden(): void {
- $this->expectException(\OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden::class);
+ $this->expectException(PasswordLoginForbidden::class);
$this->userSession
->expects($this->once())
@@ -211,7 +214,7 @@ class AuthTest extends TestCase {
->expects($this->once())
->method('logClientIn')
->with('MyTestUser', 'MyTestPassword')
- ->will($this->throwException(new \OC\Authentication\Exceptions\PasswordLoginForbiddenException()));
+ ->will($this->throwException(new PasswordLoginForbiddenException()));
$this->session
->expects($this->once())
->method('close');
diff --git a/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php b/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php
index 9922dee5e6e..06c070454af 100644
--- a/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php
@@ -5,6 +5,7 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OC\User\Session;
use OCA\DAV\Connector\Sabre\BearerAuth;
use OCP\IRequest;
use OCP\ISession;
@@ -30,7 +31,7 @@ class BearerAuthTest extends TestCase {
protected function setUp(): void {
parent::setUp();
- $this->userSession = $this->createMock(\OC\User\Session::class);
+ $this->userSession = $this->createMock(Session::class);
$this->session = $this->createMock(ISession::class);
$this->request = $this->createMock(IRequest::class);
diff --git a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
index 7da38afdf3a..3f134745f86 100644
--- a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
@@ -10,6 +10,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OCA\DAV\CalDAV\DefaultCalendarValidator;
use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\File;
+use OCA\DAV\DAV\CustomPropertiesBackend;
use OCP\IUser;
use PHPUnit\Framework\MockObject\MockObject;
use Sabre\DAV\Tree;
@@ -34,7 +35,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
private $tree;
/**
- * @var \OCA\DAV\DAV\CustomPropertiesBackend
+ * @var CustomPropertiesBackend
*/
private $plugin;
@@ -64,7 +65,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
$this->defaultCalendarValidator = $this->createMock(DefaultCalendarValidator::class);
- $this->plugin = new \OCA\DAV\DAV\CustomPropertiesBackend(
+ $this->plugin = new CustomPropertiesBackend(
$this->server,
$this->tree,
\OC::$server->getDatabaseConnection(),
diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
index 3490937a543..d659b01d039 100644
--- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
@@ -13,12 +13,16 @@ use OC\Files\Node\Node;
use OC\Files\Storage\Wrapper\Quota;
use OC\Files\View;
use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Connector\Sabre\Exception\Forbidden;
+use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
use OCP\Constants;
use OCP\Files\ForbiddenException;
+use OCP\Files\InvalidPathException;
use OCP\Files\Mount\IMountPoint;
+use OCP\Files\StorageNotAvailableException;
use Test\Traits\UserTrait;
-class TestViewDirectory extends \OC\Files\View {
+class TestViewDirectory extends View {
private $updatables;
private $deletables;
private $canRename;
@@ -106,7 +110,7 @@ class DirectoryTest extends \Test\TestCase {
public function testDeleteForbidden(): void {
- $this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
+ $this->expectException(Forbidden::class);
// deletion allowed
$this->info->expects($this->once())
@@ -250,7 +254,7 @@ class DirectoryTest extends \Test\TestCase {
$this->view->expects($this->once())
->method('getFileInfo')
- ->willThrowException(new \OCP\Files\StorageNotAvailableException());
+ ->willThrowException(new StorageNotAvailableException());
$dir = new Directory($this->view, $this->info);
$dir->getChild('.');
@@ -258,11 +262,11 @@ class DirectoryTest extends \Test\TestCase {
public function testGetChildThrowInvalidPath(): void {
- $this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
+ $this->expectException(InvalidPath::class);
$this->view->expects($this->once())
->method('verifyPath')
- ->willThrowException(new \OCP\Files\InvalidPathException());
+ ->willThrowException(new InvalidPathException());
$this->view->expects($this->never())
->method('getFileInfo');
@@ -398,7 +402,7 @@ class DirectoryTest extends \Test\TestCase {
* @dataProvider moveFailedInvalidCharsProvider
*/
public function testMoveFailedInvalidChars($source, $destination, $updatables, $deletables): void {
- $this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
+ $this->expectException(InvalidPath::class);
$this->moveTest($source, $destination, $updatables, $deletables);
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
index 55a6783225d..ef02f145375 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
@@ -13,16 +13,29 @@ use OC\Files\Storage\Local;
use OC\Files\Storage\Temporary;
use OC\Files\Storage\Wrapper\PermissionsMask;
use OC\Files\View;
+use OCA\DAV\Connector\Sabre\Exception\FileLocked;
+use OCA\DAV\Connector\Sabre\Exception\Forbidden;
+use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
use OCA\DAV\Connector\Sabre\File;
use OCP\Constants;
+use OCP\Encryption\Exceptions\GenericEncryptionException;
+use OCP\Files\EntityTooLargeException;
use OCP\Files\FileInfo;
use OCP\Files\ForbiddenException;
+use OCP\Files\InvalidContentException;
+use OCP\Files\InvalidPathException;
+use OCP\Files\LockNotAcquiredException;
+use OCP\Files\NotPermittedException;
use OCP\Files\Storage\IStorage;
+use OCP\Files\StorageNotAvailableException;
use OCP\IConfig;
use OCP\IRequestId;
use OCP\ITempManager;
use OCP\IUserManager;
use OCP\Lock\ILockingProvider;
+use OCP\Lock\LockedException;
+use OCP\Server;
+use OCP\Util;
use PHPUnit\Framework\MockObject\MockObject;
use Test\HookHelper;
use Test\TestCase;
@@ -66,7 +79,7 @@ class FileTest extends TestCase {
}
protected function tearDown(): void {
- $userManager = \OCP\Server::get(IUserManager::class);
+ $userManager = Server::get(IUserManager::class);
$userManager->get($this->user)->delete();
parent::tearDown();
@@ -98,39 +111,39 @@ class FileTest extends TestCase {
false
],
[
- new \OCP\Files\NotPermittedException(),
+ new NotPermittedException(),
'Sabre\DAV\Exception\Forbidden'
],
[
- new \OCP\Files\EntityTooLargeException(),
+ new EntityTooLargeException(),
'OCA\DAV\Connector\Sabre\Exception\EntityTooLarge'
],
[
- new \OCP\Files\InvalidContentException(),
+ new InvalidContentException(),
'OCA\DAV\Connector\Sabre\Exception\UnsupportedMediaType'
],
[
- new \OCP\Files\InvalidPathException(),
+ new InvalidPathException(),
'Sabre\DAV\Exception\Forbidden'
],
[
- new \OCP\Files\ForbiddenException('', true),
+ new ForbiddenException('', true),
'OCA\DAV\Connector\Sabre\Exception\Forbidden'
],
[
- new \OCP\Files\LockNotAcquiredException('/test.txt', 1),
+ new LockNotAcquiredException('/test.txt', 1),
'OCA\DAV\Connector\Sabre\Exception\FileLocked'
],
[
- new \OCP\Lock\LockedException('/test.txt'),
+ new LockedException('/test.txt'),
'OCA\DAV\Connector\Sabre\Exception\FileLocked'
],
[
- new \OCP\Encryption\Exceptions\GenericEncryptionException(),
+ new GenericEncryptionException(),
'Sabre\DAV\Exception\ServiceUnavailable'
],
[
- new \OCP\Files\StorageNotAvailableException(),
+ new StorageNotAvailableException(),
'Sabre\DAV\Exception\ServiceUnavailable'
],
[
@@ -152,9 +165,9 @@ class FileTest extends TestCase {
// setup
$storage = $this->getMockBuilder(Local::class)
->onlyMethods(['writeStream'])
- ->setConstructorArgs([['datadir' => \OCP\Server::get(ITempManager::class)->getTemporaryFolder()]])
+ ->setConstructorArgs([['datadir' => Server::get(ITempManager::class)->getTemporaryFolder()]])
->getMock();
- \OC\Files\Filesystem::mount($storage, [], $this->user . '/');
+ Filesystem::mount($storage, [], $this->user . '/');
/** @var View | MockObject $view */
$view = $this->getMockBuilder(View::class)
->onlyMethods(['getRelativePath', 'resolvePath'])
@@ -182,11 +195,11 @@ class FileTest extends TestCase {
->willReturnArgument(0);
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
- 'permissions' => \OCP\Constants::PERMISSION_ALL,
+ 'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FOLDER,
], null);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $file = new File($view, $info);
// action
$caughtException = null;
@@ -214,9 +227,9 @@ class FileTest extends TestCase {
* @return null|string of the PUT operation which is usually the etag
*/
private function doPut($path, $viewRoot = null, ?Request $request = null) {
- $view = \OC\Files\Filesystem::getView();
+ $view = Filesystem::getView();
if (!is_null($viewRoot)) {
- $view = new \OC\Files\View($viewRoot);
+ $view = new View($viewRoot);
} else {
$viewRoot = '/' . $this->user . '/files';
}
@@ -226,14 +239,14 @@ class FileTest extends TestCase {
$this->getMockStorage(),
null,
[
- 'permissions' => \OCP\Constants::PERMISSION_ALL,
+ 'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FOLDER,
],
null
);
- /** @var \OCA\DAV\Connector\Sabre\File | MockObject $file */
- $file = $this->getMockBuilder(\OCA\DAV\Connector\Sabre\File::class)
+ /** @var File|MockObject $file */
+ $file = $this->getMockBuilder(File::class)
->setConstructorArgs([$view, $info, null, $request])
->onlyMethods(['header'])
->getMock();
@@ -367,7 +380,7 @@ class FileTest extends TestCase {
* Test that putting a file triggers update hooks
*/
public function testPutOverwriteFileTriggersHooks(): void {
- $view = \OC\Files\Filesystem::getView();
+ $view = Filesystem::getView();
$view->file_put_contents('/foo.txt', 'some content that will be replaced');
HookHelper::setUpHooks();
@@ -403,7 +416,7 @@ class FileTest extends TestCase {
* where the root is the share root)
*/
public function testPutSingleFileTriggersHooksDifferentRoot(): void {
- $view = \OC\Files\Filesystem::getView();
+ $view = Filesystem::getView();
$view->mkdir('noderoot');
HookHelper::setUpHooks();
@@ -445,7 +458,7 @@ class FileTest extends TestCase {
* Test put file with cancelled hook
*/
public function testPutSingleFileCancelPreHook(): void {
- \OCP\Util::connectHook(
+ Util::connectHook(
Filesystem::CLASSNAME,
Filesystem::signal_create,
'\Test\HookHelper',
@@ -493,11 +506,11 @@ class FileTest extends TestCase {
], $this->requestId, $this->config, null);
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
- 'permissions' => \OCP\Constants::PERMISSION_ALL,
+ 'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FOLDER,
], null);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info, null, $request);
+ $file = new File($view, $info, null, $request);
// action
$thrown = false;
@@ -521,17 +534,17 @@ class FileTest extends TestCase {
* Test exception during final rename in simple upload mode
*/
public function testSimplePutFailsMoveFromStorage(): void {
- $view = new \OC\Files\View('/' . $this->user . '/files');
+ $view = new View('/' . $this->user . '/files');
// simulate situation where the target file is locked
$view->lockFile('/test.txt', ILockingProvider::LOCK_EXCLUSIVE);
$info = new \OC\Files\FileInfo('/' . $this->user . '/files/test.txt', $this->getMockStorage(), null, [
- 'permissions' => \OCP\Constants::PERMISSION_ALL,
+ 'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FOLDER,
], null);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $file = new File($view, $info);
// action
$thrown = false;
@@ -543,7 +556,7 @@ class FileTest extends TestCase {
// afterMethod unlocks
$view->unlockFile($info->getPath(), ILockingProvider::LOCK_SHARED);
- } catch (\OCA\DAV\Connector\Sabre\Exception\FileLocked $e) {
+ } catch (FileLocked $e) {
$thrown = true;
}
@@ -565,10 +578,10 @@ class FileTest extends TestCase {
->willReturnArgument(0);
$info = new \OC\Files\FileInfo("/i\nvalid", $this->getMockStorage(), null, [
- 'permissions' => \OCP\Constants::PERMISSION_ALL,
+ 'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FOLDER,
], null);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $file = new File($view, $info);
// action
$thrown = false;
@@ -580,7 +593,7 @@ class FileTest extends TestCase {
// afterMethod unlocks
$view->unlockFile($info->getPath(), ILockingProvider::LOCK_SHARED);
- } catch (\OCA\DAV\Connector\Sabre\Exception\InvalidPath $e) {
+ } catch (InvalidPath $e) {
$thrown = true;
}
@@ -593,7 +606,7 @@ class FileTest extends TestCase {
*
*/
public function testSetNameInvalidChars(): void {
- $this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
+ $this->expectException(InvalidPath::class);
// setup
/** @var View|MockObject */
@@ -606,10 +619,10 @@ class FileTest extends TestCase {
->willReturnArgument(0);
$info = new \OC\Files\FileInfo('/valid', $this->getMockStorage(), null, [
- 'permissions' => \OCP\Constants::PERMISSION_ALL,
+ 'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FOLDER,
], null);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $file = new File($view, $info);
$file->setName("/i\nvalid");
}
@@ -640,11 +653,11 @@ class FileTest extends TestCase {
], $this->requestId, $this->config, null);
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
- 'permissions' => \OCP\Constants::PERMISSION_ALL,
+ 'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FOLDER,
], null);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info, null, $request);
+ $file = new File($view, $info, null, $request);
// action
$thrown = false;
@@ -676,11 +689,11 @@ class FileTest extends TestCase {
->willReturn(true);
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
- 'permissions' => \OCP\Constants::PERMISSION_ALL,
+ 'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FOLDER,
], null);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $file = new File($view, $info);
// action
$file->delete();
@@ -700,7 +713,7 @@ class FileTest extends TestCase {
'type' => FileInfo::TYPE_FOLDER,
], null);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $file = new File($view, $info);
// action
$file->delete();
@@ -721,11 +734,11 @@ class FileTest extends TestCase {
->willReturn(false);
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
- 'permissions' => \OCP\Constants::PERMISSION_ALL,
+ 'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FOLDER,
], null);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $file = new File($view, $info);
// action
$file->delete();
@@ -733,7 +746,7 @@ class FileTest extends TestCase {
public function testDeleteThrowsWhenDeletionThrows(): void {
- $this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
+ $this->expectException(Forbidden::class);
// setup
/** @var View|MockObject */
@@ -746,11 +759,11 @@ class FileTest extends TestCase {
->willThrowException(new ForbiddenException('', true));
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
- 'permissions' => \OCP\Constants::PERMISSION_ALL,
+ 'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FOLDER,
], null);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $file = new File($view, $info);
// action
$file->delete();
@@ -776,7 +789,7 @@ class FileTest extends TestCase {
* Test whether locks are set before and after the operation
*/
public function testPutLocking(): void {
- $view = new \OC\Files\View('/' . $this->user . '/files/');
+ $view = new View('/' . $this->user . '/files/');
$path = 'test-locking.txt';
$info = new \OC\Files\FileInfo(
@@ -784,20 +797,20 @@ class FileTest extends TestCase {
$this->getMockStorage(),
null,
[
- 'permissions' => \OCP\Constants::PERMISSION_ALL,
+ 'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FOLDER,
],
null
);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $file = new File($view, $info);
$this->assertFalse(
- $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED),
+ $this->isFileLocked($view, $path, ILockingProvider::LOCK_SHARED),
'File unlocked before put'
);
$this->assertFalse(
- $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE),
+ $this->isFileLocked($view, $path, ILockingProvider::LOCK_EXCLUSIVE),
'File unlocked before put'
);
@@ -813,26 +826,26 @@ class FileTest extends TestCase {
->method('writeCallback')
->willReturnCallback(
function () use ($view, $path, &$wasLockedPre): void {
- $wasLockedPre = $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED);
- $wasLockedPre = $wasLockedPre && !$this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE);
+ $wasLockedPre = $this->isFileLocked($view, $path, ILockingProvider::LOCK_SHARED);
+ $wasLockedPre = $wasLockedPre && !$this->isFileLocked($view, $path, ILockingProvider::LOCK_EXCLUSIVE);
}
);
$eventHandler->expects($this->once())
->method('postWriteCallback')
->willReturnCallback(
function () use ($view, $path, &$wasLockedPost): void {
- $wasLockedPost = $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED);
- $wasLockedPost = $wasLockedPost && !$this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE);
+ $wasLockedPost = $this->isFileLocked($view, $path, ILockingProvider::LOCK_SHARED);
+ $wasLockedPost = $wasLockedPost && !$this->isFileLocked($view, $path, ILockingProvider::LOCK_EXCLUSIVE);
}
);
- \OCP\Util::connectHook(
+ Util::connectHook(
Filesystem::CLASSNAME,
Filesystem::signal_write,
$eventHandler,
'writeCallback'
);
- \OCP\Util::connectHook(
+ Util::connectHook(
Filesystem::CLASSNAME,
Filesystem::signal_post_write,
$eventHandler,
@@ -851,11 +864,11 @@ class FileTest extends TestCase {
$this->assertTrue($wasLockedPost, 'File was locked during post-hooks');
$this->assertFalse(
- $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_SHARED),
+ $this->isFileLocked($view, $path, ILockingProvider::LOCK_SHARED),
'File unlocked after put'
);
$this->assertFalse(
- $this->isFileLocked($view, $path, \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE),
+ $this->isFileLocked($view, $path, ILockingProvider::LOCK_EXCLUSIVE),
'File unlocked after put'
);
}
@@ -868,9 +881,9 @@ class FileTest extends TestCase {
*
* @return array list of part files
*/
- private function listPartFiles(?\OC\Files\View $userView = null, $path = '') {
+ private function listPartFiles(?View $userView = null, $path = '') {
if ($userView === null) {
- $userView = \OC\Files\Filesystem::getView();
+ $userView = Filesystem::getView();
}
$files = [];
[$storage, $internalPath] = $userView->resolvePath($path);
@@ -919,18 +932,18 @@ class FileTest extends TestCase {
->willReturn(false);
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
- 'permissions' => \OCP\Constants::PERMISSION_ALL,
+ 'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FILE,
], null);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $file = new File($view, $info);
$file->get();
}
public function testGetFopenThrows(): void {
- $this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
+ $this->expectException(Forbidden::class);
/** @var View|MockObject */
$view = $this->getMockBuilder(View::class)
@@ -941,11 +954,11 @@ class FileTest extends TestCase {
->willThrowException(new ForbiddenException('', true));
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
- 'permissions' => \OCP\Constants::PERMISSION_ALL,
+ 'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FILE,
], null);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $file = new File($view, $info);
$file->get();
}
@@ -962,11 +975,11 @@ class FileTest extends TestCase {
->method('fopen');
$info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, [
- 'permissions' => \OCP\Constants::PERMISSION_CREATE, // no read perm
+ 'permissions' => Constants::PERMISSION_CREATE, // no read perm
'type' => FileInfo::TYPE_FOLDER,
], null);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $file = new File($view, $info);
$file->get();
}
@@ -1003,7 +1016,7 @@ class FileTest extends TestCase {
}
public function testPutLockExpired(): void {
- $view = new \OC\Files\View('/' . $this->user . '/files/');
+ $view = new View('/' . $this->user . '/files/');
$path = 'test-locking.txt';
$info = new \OC\Files\FileInfo(
@@ -1011,13 +1024,13 @@ class FileTest extends TestCase {
$this->getMockStorage(),
null,
[
- 'permissions' => \OCP\Constants::PERMISSION_ALL,
+ 'permissions' => Constants::PERMISSION_ALL,
'type' => FileInfo::TYPE_FOLDER,
],
null
);
- $file = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $file = new File($view, $info);
// don't lock before the PUT to simulate an expired shared lock
$this->assertNotEmpty($file->put($this->getStream('test data')));
diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
index 9d8f4e8d4c4..db07165ebf0 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
@@ -123,7 +123,7 @@ class FilesPluginTest extends TestCase {
}
public function testGetPropertiesForFile(): void {
- /** @var \OCA\DAV\Connector\Sabre\File | \PHPUnit\Framework\MockObject\MockObject $node */
+ /** @var File|\PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
$propFind = new PropFind(
@@ -180,7 +180,7 @@ class FilesPluginTest extends TestCase {
}
public function testGetPropertiesStorageNotAvailable(): void {
- /** @var \OCA\DAV\Connector\Sabre\File | \PHPUnit\Framework\MockObject\MockObject $node */
+ /** @var File|\PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
$propFind = new PropFind(
@@ -227,7 +227,7 @@ class FilesPluginTest extends TestCase {
0
);
- /** @var \OCA\DAV\Connector\Sabre\File | \PHPUnit\Framework\MockObject\MockObject $node */
+ /** @var File|\PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
$node->expects($this->any())
->method('getDavPermissions')
@@ -242,7 +242,7 @@ class FilesPluginTest extends TestCase {
}
public function testGetPropertiesForDirectory(): void {
- /** @var \OCA\DAV\Connector\Sabre\Directory | \PHPUnit\Framework\MockObject\MockObject $node */
+ /** @var Directory|\PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory');
$propFind = new PropFind(
@@ -277,7 +277,7 @@ class FilesPluginTest extends TestCase {
}
public function testGetPropertiesForRootDirectory(): void {
- /** @var \OCA\DAV\Connector\Sabre\Directory|\PHPUnit\Framework\MockObject\MockObject $node */
+ /** @var Directory|\PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
@@ -312,8 +312,7 @@ class FilesPluginTest extends TestCase {
// No read permissions can be caused by files access control.
// But we still want to load the directory list, so this is okay for us.
// $this->expectException(\Sabre\DAV\Exception\NotFound::class);
-
- /** @var \OCA\DAV\Connector\Sabre\Directory|\PHPUnit\Framework\MockObject\MockObject $node */
+ /** @var Directory|\PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor()
->getMock();
@@ -614,7 +613,7 @@ class FilesPluginTest extends TestCase {
}
public function testHasPreview(): void {
- /** @var \OCA\DAV\Connector\Sabre\Directory | \PHPUnit\Framework\MockObject\MockObject $node */
+ /** @var Directory|\PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory');
$propFind = new PropFind(
diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
index 76a70a93e13..8b169dcd46f 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
@@ -9,6 +9,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OC\Files\View;
use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Connector\Sabre\FilesPlugin;
use OCA\DAV\Connector\Sabre\FilesReportPlugin as FilesReportPluginImplementation;
use OCP\App\IAppManager;
use OCP\Files\File;
@@ -289,7 +290,7 @@ class FilesReportPluginTest extends \Test\TestCase {
$filesNode2,
);
- /** @var \OCA\DAV\Connector\Sabre\Directory&MockObject $reportTargetNode */
+ /** @var Directory&MockObject $reportTargetNode */
$result = $this->plugin->findNodesByFileIds($reportTargetNode, ['111', '222']);
$this->assertCount(2, $result);
@@ -342,7 +343,7 @@ class FilesReportPluginTest extends \Test\TestCase {
$filesNode2,
);
- /** @var \OCA\DAV\Connector\Sabre\Directory&MockObject $reportTargetNode */
+ /** @var Directory&MockObject $reportTargetNode */
$result = $this->plugin->findNodesByFileIds($reportTargetNode, ['111', '222']);
$this->assertCount(2, $result);
@@ -390,7 +391,7 @@ class FilesReportPluginTest extends \Test\TestCase {
$validator = $this->createMock(IFilenameValidator::class);
$this->server->addPlugin(
- new \OCA\DAV\Connector\Sabre\FilesPlugin(
+ new FilesPlugin(
$this->tree,
$config,
$this->createMock(IRequest::class),
diff --git a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
index c5e2b03d8b4..04cd60fbdaa 100644
--- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
@@ -13,6 +13,7 @@ use OC\Files\Mount\MountPoint;
use OC\Files\Node\Folder;
use OC\Files\View;
use OC\Share20\ShareAttributes;
+use OCA\DAV\Connector\Sabre\File;
use OCA\Files_Sharing\SharedMount;
use OCA\Files_Sharing\SharedStorage;
use OCP\Constants;
@@ -97,7 +98,7 @@ class NodeTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
- $node = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $node = new File($view, $info);
$this->assertEquals($expected, $node->getDavPermissions());
}
@@ -180,7 +181,7 @@ class NodeTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
- $node = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $node = new File($view, $info);
$this->invokePrivate($node, 'shareManager', [$shareManager]);
$this->assertEquals($expected, $node->getSharePermissions($user));
}
@@ -217,7 +218,7 @@ class NodeTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
- $node = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $node = new File($view, $info);
$this->invokePrivate($node, 'shareManager', [$shareManager]);
$this->assertEquals($attributes->toArray(), $node->getShareAttributes());
}
@@ -243,7 +244,7 @@ class NodeTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
- $node = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $node = new File($view, $info);
$this->invokePrivate($node, 'shareManager', [$shareManager]);
$this->assertEquals([], $node->getShareAttributes());
}
@@ -266,7 +267,7 @@ class NodeTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
- $node = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $node = new File($view, $info);
$result = $this->invokePrivate($node, 'sanitizeMtime', [$mtime]);
$this->assertEquals($expected, $result);
}
@@ -290,7 +291,7 @@ class NodeTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
- $node = new \OCA\DAV\Connector\Sabre\File($view, $info);
+ $node = new File($view, $info);
$result = $this->invokePrivate($node, 'sanitizeMtime', [$mtime]);
}
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
index 4f2e5174325..393f3c72c20 100644
--- a/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
@@ -10,9 +10,12 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OC\Files\FileInfo;
use OC\Files\Filesystem;
use OC\Files\Mount\Manager;
+use OC\Files\Storage\Common;
use OC\Files\Storage\Temporary;
use OC\Files\View;
use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
+use OCA\DAV\Connector\Sabre\File;
use OCA\DAV\Connector\Sabre\ObjectTree;
use OCP\Files\Mount\IMountManager;
@@ -73,7 +76,7 @@ class ObjectTreeTest extends \Test\TestCase {
->with($this->identicalTo($sourcePath))
->willReturn(false);
- /** @var \OCA\DAV\Connector\Sabre\ObjectTree $objectTree */
+ /** @var ObjectTree $objectTree */
$mountManager = Filesystem::getMountManager();
$objectTree->init($rootDir, $view, $mountManager);
$objectTree->copy($sourcePath, $targetPath);
@@ -114,7 +117,7 @@ class ObjectTreeTest extends \Test\TestCase {
$objectTree->expects($this->never())
->method('getNodeForPath');
- /** @var \OCA\DAV\Connector\Sabre\ObjectTree $objectTree */
+ /** @var ObjectTree $objectTree */
$mountManager = Filesystem::getMountManager();
$objectTree->init($rootDir, $view, $mountManager);
$objectTree->copy($sourcePath, $targetPath);
@@ -146,13 +149,13 @@ class ObjectTreeTest extends \Test\TestCase {
$fileInfo->method('getName')
->willReturn($outputFileName);
$fileInfo->method('getStorage')
- ->willReturn($this->createMock(\OC\Files\Storage\Common::class));
+ ->willReturn($this->createMock(Common::class));
$view->method('getFileInfo')
->with($fileInfoQueryPath)
->willReturn($fileInfo);
- $tree = new \OCA\DAV\Connector\Sabre\ObjectTree();
+ $tree = new ObjectTree();
$tree->init($rootNode, $view, $mountManager);
$node = $tree->getNodeForPath($inputFileName);
@@ -161,9 +164,9 @@ class ObjectTreeTest extends \Test\TestCase {
$this->assertEquals($outputFileName, $node->getName());
if ($type === 'file') {
- $this->assertTrue($node instanceof \OCA\DAV\Connector\Sabre\File);
+ $this->assertTrue($node instanceof File);
} else {
- $this->assertTrue($node instanceof \OCA\DAV\Connector\Sabre\Directory);
+ $this->assertTrue($node instanceof Directory);
}
}
@@ -202,7 +205,7 @@ class ObjectTreeTest extends \Test\TestCase {
public function testGetNodeForPathInvalidPath(): void {
- $this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
+ $this->expectException(InvalidPath::class);
$path = '/foo\bar';
@@ -223,7 +226,7 @@ class ObjectTreeTest extends \Test\TestCase {
->getMock();
$mountManager = $this->createMock(IMountManager::class);
- $tree = new \OCA\DAV\Connector\Sabre\ObjectTree();
+ $tree = new ObjectTree();
$tree->init($rootNode, $view, $mountManager);
$tree->getNodeForPath($path);
@@ -249,7 +252,7 @@ class ObjectTreeTest extends \Test\TestCase {
->getMock();
$mountManager = $this->createMock(IMountManager::class);
- $tree = new \OCA\DAV\Connector\Sabre\ObjectTree();
+ $tree = new ObjectTree();
$tree->init($rootNode, $view, $mountManager);
$this->assertInstanceOf('\Sabre\DAV\INode', $tree->getNodeForPath($path));
diff --git a/apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php b/apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php
index b6c91cd7ae5..00bddf2e69c 100644
--- a/apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/PublicAuthTest.php
@@ -7,6 +7,7 @@
*/
namespace OCA\DAV\Tests\unit\Connector;
+use OCA\DAV\Connector\Sabre\PublicAuth;
use OCP\IRequest;
use OCP\ISession;
use OCP\Security\Bruteforce\IThrottler;
@@ -49,7 +50,7 @@ class PublicAuthTest extends \Test\TestCase {
$this->throttler = $this->createMock(IThrottler::class);
$this->logger = $this->createMock(LoggerInterface::class);
- $this->auth = new \OCA\DAV\Connector\Sabre\PublicAuth(
+ $this->auth = new PublicAuth(
$this->request,
$this->shareManager,
$this->session,
diff --git a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
index 815837799fd..c370e0fb0f7 100644
--- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
@@ -16,7 +16,7 @@ class QuotaPluginTest extends TestCase {
/** @var \Sabre\DAV\Server | \PHPUnit\Framework\MockObject\MockObject */
private $server;
- /** @var \OCA\DAV\Connector\Sabre\QuotaPlugin | \PHPUnit\Framework\MockObject\MockObject */
+ /** @var QuotaPlugin|\PHPUnit\Framework\MockObject\MockObject */
private $plugin;
private function init($quota, $checkedPath = ''): void {
diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php
index 9b20b2f8630..b1e68f9597b 100644
--- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php
+++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/ExceptionPlugin.php
@@ -7,7 +7,9 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
-class ExceptionPlugin extends \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin {
+use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
+
+class ExceptionPlugin extends ExceptionLoggerPlugin {
/**
* @var \Throwable[]
*/
diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php
index 29574d53bca..67c2aa61430 100644
--- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php
+++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/RequestTestCase.php
@@ -25,7 +25,7 @@ abstract class RequestTestCase extends TestCase {
use MountProviderTrait;
/**
- * @var \OCA\DAV\Connector\Sabre\ServerFactory
+ * @var ServerFactory
*/
protected $serverFactory;
diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
index 546be840cd8..125fe3959bb 100644
--- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
@@ -10,6 +10,7 @@ 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 OCA\DAV\Connector\Sabre\SharesPlugin;
use OCA\DAV\Upload\UploadFile;
use OCP\Files\Folder;
use OCP\IUser;
@@ -19,7 +20,7 @@ use OCP\Share\IShare;
use Sabre\DAV\Tree;
class SharesPluginTest extends \Test\TestCase {
- public const SHARETYPES_PROPERTYNAME = \OCA\DAV\Connector\Sabre\SharesPlugin::SHARETYPES_PROPERTYNAME;
+ public const SHARETYPES_PROPERTYNAME = SharesPlugin::SHARETYPES_PROPERTYNAME;
/**
* @var \Sabre\DAV\Server
@@ -42,7 +43,7 @@ class SharesPluginTest extends \Test\TestCase {
private $userFolder;
/**
- * @var \OCA\DAV\Connector\Sabre\SharesPlugin
+ * @var SharesPlugin
*/
private $plugin;
@@ -61,7 +62,7 @@ class SharesPluginTest extends \Test\TestCase {
->willReturn($user);
$this->userFolder = $this->createMock(Folder::class);
- $this->plugin = new \OCA\DAV\Connector\Sabre\SharesPlugin(
+ $this->plugin = new SharesPlugin(
$this->tree,
$userSession,
$this->userFolder,
diff --git a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
index 635f62dac87..59fd1e56963 100644
--- a/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
@@ -10,15 +10,17 @@ 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 OCA\DAV\Connector\Sabre\TagList;
+use OCA\DAV\Connector\Sabre\TagsPlugin;
use OCA\DAV\Upload\UploadFile;
use OCP\ITagManager;
use OCP\ITags;
use Sabre\DAV\Tree;
class TagsPluginTest extends \Test\TestCase {
- public const TAGS_PROPERTYNAME = \OCA\DAV\Connector\Sabre\TagsPlugin::TAGS_PROPERTYNAME;
- public const FAVORITE_PROPERTYNAME = \OCA\DAV\Connector\Sabre\TagsPlugin::FAVORITE_PROPERTYNAME;
- public const TAG_FAVORITE = \OCA\DAV\Connector\Sabre\TagsPlugin::TAG_FAVORITE;
+ public const TAGS_PROPERTYNAME = TagsPlugin::TAGS_PROPERTYNAME;
+ public const FAVORITE_PROPERTYNAME = TagsPlugin::FAVORITE_PROPERTYNAME;
+ public const TAG_FAVORITE = TagsPlugin::TAG_FAVORITE;
/**
* @var \Sabre\DAV\Server
@@ -41,7 +43,7 @@ class TagsPluginTest extends \Test\TestCase {
private $tagger;
/**
- * @var \OCA\DAV\Connector\Sabre\TagsPlugin
+ * @var TagsPlugin
*/
private $plugin;
@@ -61,7 +63,7 @@ class TagsPluginTest extends \Test\TestCase {
->method('load')
->with('files')
->willReturn($this->tagger);
- $this->plugin = new \OCA\DAV\Connector\Sabre\TagsPlugin($this->tree, $this->tagManager);
+ $this->plugin = new TagsPlugin($this->tree, $this->tagManager);
$this->plugin->initialize($this->server);
}
@@ -194,7 +196,7 @@ class TagsPluginTest extends \Test\TestCase {
[self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME],
[
200 => [
- self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2']),
+ self::TAGS_PROPERTYNAME => new TagList(['tag1', 'tag2']),
self::FAVORITE_PROPERTYNAME => true,
]
]
@@ -205,7 +207,7 @@ class TagsPluginTest extends \Test\TestCase {
[self::TAGS_PROPERTYNAME],
[
200 => [
- self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2']),
+ self::TAGS_PROPERTYNAME => new TagList(['tag1', 'tag2']),
]
]
],
@@ -233,7 +235,7 @@ class TagsPluginTest extends \Test\TestCase {
[self::TAGS_PROPERTYNAME, self::FAVORITE_PROPERTYNAME],
[
200 => [
- self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList([]),
+ self::TAGS_PROPERTYNAME => new TagList([]),
self::FAVORITE_PROPERTYNAME => false,
]
]
@@ -296,7 +298,7 @@ class TagsPluginTest extends \Test\TestCase {
// properties to set
$propPatch = new \Sabre\DAV\PropPatch([
- self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2', 'tagkeep'])
+ self::TAGS_PROPERTYNAME => new TagList(['tag1', 'tag2', 'tagkeep'])
]);
$this->plugin->handleUpdateProperties(
@@ -342,7 +344,7 @@ class TagsPluginTest extends \Test\TestCase {
// properties to set
$propPatch = new \Sabre\DAV\PropPatch([
- self::TAGS_PROPERTYNAME => new \OCA\DAV\Connector\Sabre\TagList(['tag1', 'tag2'])
+ self::TAGS_PROPERTYNAME => new TagList(['tag1', 'tag2'])
]);
$this->plugin->handleUpdateProperties(
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
index 308950cef34..ed830685b7a 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
@@ -8,6 +8,7 @@
namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag;
+use OCA\DAV\SystemTag\SystemTagMappingNode;
use OCP\IUser;
use OCP\SystemTag\ISystemTag;
use OCP\SystemTag\ISystemTagManager;
@@ -34,7 +35,7 @@ class SystemTagMappingNodeTest extends \Test\TestCase {
if ($tag === null) {
$tag = new SystemTag(1, 'Test', true, true);
}
- return new \OCA\DAV\SystemTag\SystemTagMappingNode(
+ return new SystemTagMappingNode(
$tag,
123,
'files',
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
index 82aa81674df..7ad1d34d94f 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
@@ -8,6 +8,7 @@
namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag;
+use OCA\DAV\SystemTag\SystemTagNode;
use OCP\IUser;
use OCP\SystemTag\ISystemTag;
use OCP\SystemTag\ISystemTagManager;
@@ -40,7 +41,7 @@ class SystemTagNodeTest extends \Test\TestCase {
if ($tag === null) {
$tag = new SystemTag(1, 'Test', true, true);
}
- return new \OCA\DAV\SystemTag\SystemTagNode(
+ return new SystemTagNode(
$tag,
$this->user,
$isAdmin,
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
index 67e7afa9c54..91dab4ecf11 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
@@ -9,6 +9,7 @@ namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag;
use OCA\DAV\SystemTag\SystemTagNode;
+use OCA\DAV\SystemTag\SystemTagPlugin;
use OCA\DAV\SystemTag\SystemTagsByIdCollection;
use OCA\DAV\SystemTag\SystemTagsObjectMappingCollection;
use OCP\IGroupManager;
@@ -23,12 +24,12 @@ use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
class SystemTagPluginTest extends \Test\TestCase {
- public const ID_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::ID_PROPERTYNAME;
- public const DISPLAYNAME_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::DISPLAYNAME_PROPERTYNAME;
- public const USERVISIBLE_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::USERVISIBLE_PROPERTYNAME;
- public const USERASSIGNABLE_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::USERASSIGNABLE_PROPERTYNAME;
- public const CANASSIGN_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::CANASSIGN_PROPERTYNAME;
- public const GROUPS_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::GROUPS_PROPERTYNAME;
+ public const ID_PROPERTYNAME = SystemTagPlugin::ID_PROPERTYNAME;
+ public const DISPLAYNAME_PROPERTYNAME = SystemTagPlugin::DISPLAYNAME_PROPERTYNAME;
+ public const USERVISIBLE_PROPERTYNAME = SystemTagPlugin::USERVISIBLE_PROPERTYNAME;
+ public const USERASSIGNABLE_PROPERTYNAME = SystemTagPlugin::USERASSIGNABLE_PROPERTYNAME;
+ public const CANASSIGN_PROPERTYNAME = SystemTagPlugin::CANASSIGN_PROPERTYNAME;
+ public const GROUPS_PROPERTYNAME = SystemTagPlugin::GROUPS_PROPERTYNAME;
/**
* @var \Sabre\DAV\Server
@@ -61,7 +62,7 @@ class SystemTagPluginTest extends \Test\TestCase {
private $user;
/**
- * @var \OCA\DAV\SystemTag\SystemTagPlugin
+ * @var SystemTagPlugin
*/
private $plugin;
@@ -97,7 +98,7 @@ class SystemTagPluginTest extends \Test\TestCase {
$this->tagMapper = $this->getMockBuilder(ISystemTagObjectMapper::class)
->getMock();
- $this->plugin = new \OCA\DAV\SystemTag\SystemTagPlugin(
+ $this->plugin = new SystemTagPlugin(
$this->tagManager,
$this->groupManager,
$this->userSession,
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
index db55d82adc9..2ffbc1cf01f 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
@@ -8,6 +8,7 @@
namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag;
+use OCA\DAV\SystemTag\SystemTagsByIdCollection;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserSession;
@@ -50,7 +51,7 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
->method('isAdmin')
->with('testuser')
->willReturn($isAdmin);
- return new \OCA\DAV\SystemTag\SystemTagsByIdCollection(
+ return new SystemTagsByIdCollection(
$this->tagManager,
$userSession,
$groupManager
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
index c2e62f73828..66052847f16 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
@@ -8,6 +8,7 @@
namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag;
+use OCA\DAV\SystemTag\SystemTagsObjectMappingCollection;
use OCP\IUser;
use OCP\SystemTag\ISystemTagManager;
use OCP\SystemTag\ISystemTagObjectMapper;
@@ -31,7 +32,7 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
}
public function getNode(array $writableNodeIds = []) {
- return new \OCA\DAV\SystemTag\SystemTagsObjectMappingCollection(
+ return new SystemTagsObjectMappingCollection(
111,
'files',
$this->user,
diff --git a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
index b202f340e32..62f6963e202 100644
--- a/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
+++ b/apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
@@ -7,7 +7,9 @@
*/
namespace OCA\DAV\Tests\unit\SystemTag;
+use OCA\DAV\SystemTag\SystemTagsObjectTypeCollection;
use OCP\Files\Folder;
+use OCP\Files\Node;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserSession;
@@ -17,7 +19,7 @@ use OCP\SystemTag\ISystemTagObjectMapper;
class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
/**
- * @var \OCA\DAV\SystemTag\SystemTagsObjectTypeCollection
+ * @var SystemTagsObjectTypeCollection
*/
private $node;
@@ -79,7 +81,7 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
return false;
};
- $this->node = new \OCA\DAV\SystemTag\SystemTagsObjectTypeCollection(
+ $this->node = new SystemTagsObjectTypeCollection(
'files',
$this->tagManager,
$this->tagMapper,
@@ -108,7 +110,7 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
$this->userFolder->expects($this->once())
->method('getFirstNodeById')
->with('555')
- ->willReturn($this->createMock(\OCP\Files\Node::class));
+ ->willReturn($this->createMock(Node::class));
$childNode = $this->node->getChild('555');
$this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection', $childNode);
@@ -137,7 +139,7 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
$this->userFolder->expects($this->once())
->method('getFirstNodeById')
->with('123')
- ->willReturn($this->createMock(\OCP\Files\Node::class));
+ ->willReturn($this->createMock(Node::class));
$this->assertTrue($this->node->childExists('123'));
}
diff --git a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php
index a8517bf757c..51c53fb262f 100644
--- a/apps/dav/tests/unit/Upload/AssemblyStreamTest.php
+++ b/apps/dav/tests/unit/Upload/AssemblyStreamTest.php
@@ -7,6 +7,7 @@
*/
namespace OCA\DAV\Tests\unit\Upload;
+use OCA\DAV\Upload\AssemblyStream;
use Sabre\DAV\File;
class AssemblyStreamTest extends \Test\TestCase {
@@ -15,7 +16,7 @@ class AssemblyStreamTest extends \Test\TestCase {
* @dataProvider providesNodes()
*/
public function testGetContents($expected, $nodes): void {
- $stream = \OCA\DAV\Upload\AssemblyStream::wrap($nodes);
+ $stream = AssemblyStream::wrap($nodes);
$content = stream_get_contents($stream);
$this->assertEquals($expected, $content);
@@ -25,7 +26,7 @@ class AssemblyStreamTest extends \Test\TestCase {
* @dataProvider providesNodes()
*/
public function testGetContentsFread($expected, $nodes): void {
- $stream = \OCA\DAV\Upload\AssemblyStream::wrap($nodes);
+ $stream = AssemblyStream::wrap($nodes);
$content = '';
while (!feof($stream)) {
@@ -39,7 +40,7 @@ class AssemblyStreamTest extends \Test\TestCase {
* @dataProvider providesNodes()
*/
public function testSeek($expected, $nodes): void {
- $stream = \OCA\DAV\Upload\AssemblyStream::wrap($nodes);
+ $stream = AssemblyStream::wrap($nodes);
$offset = floor(strlen($expected) * 0.6);
if (fseek($stream, $offset) === -1) {
diff --git a/apps/dav/tests/unit/Upload/FutureFileTest.php b/apps/dav/tests/unit/Upload/FutureFileTest.php
index 9ec455a9595..750670992eb 100644
--- a/apps/dav/tests/unit/Upload/FutureFileTest.php
+++ b/apps/dav/tests/unit/Upload/FutureFileTest.php
@@ -8,6 +8,7 @@
namespace OCA\DAV\Tests\unit\Upload;
use OCA\DAV\Connector\Sabre\Directory;
+use OCA\DAV\Upload\FutureFile;
class FutureFileTest extends \Test\TestCase {
public function testGetContentType(): void {
@@ -50,7 +51,7 @@ class FutureFileTest extends \Test\TestCase {
$d->expects($this->once())
->method('delete');
- $f = new \OCA\DAV\Upload\FutureFile($d, 'foo.txt');
+ $f = new FutureFile($d, 'foo.txt');
$f->delete();
}
@@ -71,7 +72,7 @@ class FutureFileTest extends \Test\TestCase {
}
/**
- * @return \OCA\DAV\Upload\FutureFile
+ * @return FutureFile
*/
private function mockFutureFile() {
$d = $this->getMockBuilder(Directory::class)
@@ -91,6 +92,6 @@ class FutureFileTest extends \Test\TestCase {
->method('getChildren')
->willReturn([]);
- return new \OCA\DAV\Upload\FutureFile($d, 'foo.txt');
+ return new FutureFile($d, 'foo.txt');
}
}