11<?php
2+
23/**
34 * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
45 * SPDX-License-Identifier: AGPL-3.0-only
910use OC \Preview \BackgroundCleanupJob ;
1011use OC \Preview \Storage \Root ;
1112use OC \PreviewManager ;
13+ use OCP \App \IAppManager ;
1214use OCP \AppFramework \Utility \ITimeFactory ;
1315use OCP \Files \File ;
1416use OCP \Files \IMimeTypeLoader ;
1517use OCP \Files \IRootFolder ;
1618use OCP \Files \NotFoundException ;
1719use OCP \IDBConnection ;
20+ use OCP \IPreview ;
21+ use OCP \Server ;
1822use Test \Traits \MountProviderTrait ;
1923use Test \Traits \UserTrait ;
2024
2832class BackgroundCleanupJobTest extends \Test \TestCase {
2933 use MountProviderTrait;
3034 use UserTrait;
31-
32- /** @var string */
33- private $ userId ;
34-
35- /** @var bool */
36- private $ trashEnabled ;
37-
38- /** @var IDBConnection */
39- private $ connection ;
40-
41- /** @var PreviewManager */
42- private $ previewManager ;
43-
44- /** @var IRootFolder */
45- private $ rootFolder ;
46-
47- /** @var IMimeTypeLoader */
48- private $ mimeTypeLoader ;
49-
35+ private string $ userId ;
36+ private bool $ trashEnabled ;
37+ private IDBConnection $ connection ;
38+ private PreviewManager $ previewManager ;
39+ private IRootFolder $ rootFolder ;
40+ private IMimeTypeLoader $ mimeTypeLoader ;
5041 private ITimeFactory $ timeFactory ;
5142
5243 protected function setUp (): void {
@@ -62,20 +53,20 @@ protected function setUp(): void {
6253 $ this ->logout ();
6354 $ this ->loginAsUser ($ this ->userId );
6455
65- $ appManager = \ OC :: $ server -> getAppManager ( );
56+ $ appManager = Server:: get (IAppManager::class );
6657 $ this ->trashEnabled = $ appManager ->isEnabledForUser ('files_trashbin ' , $ user );
6758 $ appManager ->disableApp ('files_trashbin ' );
6859
69- $ this ->connection = \ OC :: $ server -> getDatabaseConnection ( );
70- $ this ->previewManager = \ OC :: $ server -> getPreviewManager ( );
71- $ this ->rootFolder = \ OC :: $ server -> get (IRootFolder::class);
72- $ this ->mimeTypeLoader = \ OC :: $ server -> getMimeTypeLoader ( );
73- $ this ->timeFactory = \ OCP \ Server::get (ITimeFactory::class);
60+ $ this ->connection = Server:: get (IDBConnection::class );
61+ $ this ->previewManager = Server:: get (IPreview::class );
62+ $ this ->rootFolder = Server:: get (IRootFolder::class);
63+ $ this ->mimeTypeLoader = Server:: get (IMimeTypeLoader::class );
64+ $ this ->timeFactory = Server::get (ITimeFactory::class);
7465 }
7566
7667 protected function tearDown (): void {
7768 if ($ this ->trashEnabled ) {
78- $ appManager = \ OC :: $ server -> getAppManager ( );
69+ $ appManager = Server:: get (IAppManager::class );
7970 $ appManager ->enableApp ('files_trashbin ' );
8071 }
8172
0 commit comments