aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Preview/BackgroundCleanupJobTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Preview/BackgroundCleanupJobTest.php')
-rw-r--r--tests/lib/Preview/BackgroundCleanupJobTest.php43
1 files changed, 17 insertions, 26 deletions
diff --git a/tests/lib/Preview/BackgroundCleanupJobTest.php b/tests/lib/Preview/BackgroundCleanupJobTest.php
index 945366cde9f..cecb4a7a212 100644
--- a/tests/lib/Preview/BackgroundCleanupJobTest.php
+++ b/tests/lib/Preview/BackgroundCleanupJobTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-only
@@ -9,12 +10,15 @@ namespace Test\Preview;
use OC\Preview\BackgroundCleanupJob;
use OC\Preview\Storage\Root;
use OC\PreviewManager;
+use OCP\App\IAppManager;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\File;
use OCP\Files\IMimeTypeLoader;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\IDBConnection;
+use OCP\IPreview;
+use OCP\Server;
use Test\Traits\MountProviderTrait;
use Test\Traits\UserTrait;
@@ -28,25 +32,12 @@ use Test\Traits\UserTrait;
class BackgroundCleanupJobTest extends \Test\TestCase {
use MountProviderTrait;
use UserTrait;
-
- /** @var string */
- private $userId;
-
- /** @var bool */
- private $trashEnabled;
-
- /** @var IDBConnection */
- private $connection;
-
- /** @var PreviewManager */
- private $previewManager;
-
- /** @var IRootFolder */
- private $rootFolder;
-
- /** @var IMimeTypeLoader */
- private $mimeTypeLoader;
-
+ private string $userId;
+ private bool $trashEnabled;
+ private IDBConnection $connection;
+ private PreviewManager $previewManager;
+ private IRootFolder $rootFolder;
+ private IMimeTypeLoader $mimeTypeLoader;
private ITimeFactory $timeFactory;
protected function setUp(): void {
@@ -62,20 +53,20 @@ class BackgroundCleanupJobTest extends \Test\TestCase {
$this->logout();
$this->loginAsUser($this->userId);
- $appManager = \OC::$server->getAppManager();
+ $appManager = Server::get(IAppManager::class);
$this->trashEnabled = $appManager->isEnabledForUser('files_trashbin', $user);
$appManager->disableApp('files_trashbin');
- $this->connection = \OC::$server->getDatabaseConnection();
- $this->previewManager = \OC::$server->getPreviewManager();
- $this->rootFolder = \OC::$server->get(IRootFolder::class);
- $this->mimeTypeLoader = \OC::$server->getMimeTypeLoader();
- $this->timeFactory = \OCP\Server::get(ITimeFactory::class);
+ $this->connection = Server::get(IDBConnection::class);
+ $this->previewManager = Server::get(IPreview::class);
+ $this->rootFolder = Server::get(IRootFolder::class);
+ $this->mimeTypeLoader = Server::get(IMimeTypeLoader::class);
+ $this->timeFactory = Server::get(ITimeFactory::class);
}
protected function tearDown(): void {
if ($this->trashEnabled) {
- $appManager = \OC::$server->getAppManager();
+ $appManager = Server::get(IAppManager::class);
$appManager->enableApp('files_trashbin');
}