Skip to content

Commit 47dbf53

Browse files
committed
chore(Filesystem): Deprecate tearDown()
Signed-off-by: provokateurin <kate@provokateurin.de>
1 parent f664c7d commit 47dbf53

10 files changed

Lines changed: 21 additions & 20 deletions

File tree

apps/federatedfilesharing/tests/TestCase.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use OC\Files\Filesystem;
1313
use OC\Group\Database;
1414
use OCP\Files\IRootFolder;
15+
use OCP\Files\ISetupManager;
1516
use OCP\IGroupManager;
1617
use OCP\IUserManager;
1718
use OCP\IUserSession;
@@ -57,9 +58,8 @@ public static function tearDownAfterClass(): void {
5758
$user->delete();
5859
}
5960

60-
\OC_Util::tearDownFS();
61+
Server::get(ISetupManager::class)->tearDown();
6162
\OC_User::setUserId('');
62-
Filesystem::tearDown();
6363

6464
// reset backend
6565
Server::get(IUserManager::class)->clearBackends();
@@ -87,9 +87,8 @@ protected static function loginHelper(string $user, bool $create = false, bool $
8787
}
8888
}
8989

90-
\OC_Util::tearDownFS();
90+
Server::get(ISetupManager::class)->tearDown();
9191
Server::get(IUserSession::class)->setUser(null);
92-
Filesystem::tearDown();
9392
Server::get(IUserSession::class)->login($user, $password);
9493
Server::get(IRootFolder::class)->getUserFolder($user);
9594

apps/files/tests/Sharing/Source/NodeShareSourceTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use OCP\EventDispatcher\IEventDispatcher;
1919
use OCP\Files\Cache\IFileAccess;
2020
use OCP\Files\IRootFolder;
21+
use OCP\Files\ISetupManager;
2122
use OCP\Files\Node;
2223
use OCP\IDBConnection;
2324
use OCP\IURLGenerator;
@@ -69,7 +70,7 @@ public function setUp(): void {
6970
protected function tearDown(): void {
7071
$this->user1->delete();
7172

72-
Filesystem::tearDown();
73+
Server::get(ISetupManager::class)->tearDown();
7374

7475
parent::tearDown();
7576
}

apps/files_sharing/tests/Controller/ShareControllerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use OCP\EventDispatcher\IEventDispatcher;
3333
use OCP\Files\File;
3434
use OCP\Files\IRootFolder;
35+
use OCP\Files\ISetupManager;
3536
use OCP\Files\NotFoundException;
3637
use OCP\Files\Template\ITemplateManager;
3738
use OCP\IAppConfig;
@@ -153,14 +154,13 @@ protected function setUp(): void {
153154
$this->user = Server::get(ISecureRandom::class)->generate(12, ISecureRandom::CHAR_LOWER);
154155

155156
$this->createUser($this->user, $this->user);
156-
\OC_Util::tearDownFS();
157+
Server::get(ISetupManager::class)->tearDown();
157158
$this->loginAsUser($this->user);
158159
}
159160

160161
protected function tearDown(): void {
161-
\OC_Util::tearDownFS();
162+
Server::get(ISetupManager::class)->tearDown();
162163
\OC_User::setUserId('');
163-
Filesystem::tearDown();
164164
$user = Server::get(IUserManager::class)->get($this->user);
165165
if ($user !== null) {
166166
$user->delete();

apps/files_trashbin/tests/TrashbinTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use OCP\Files\File;
2828
use OCP\Files\FileInfo;
2929
use OCP\Files\IRootFolder;
30+
use OCP\Files\ISetupManager;
3031
use OCP\IConfig;
3132
use OCP\IDBConnection;
3233
use OCP\IUserManager;
@@ -700,9 +701,8 @@ public static function loginHelper($user, $create = false) {
700701
}
701702
}
702703

703-
\OC_Util::tearDownFS();
704+
Server::get(ISetupManager::class)->tearDown();
704705
\OC_User::setUserId('');
705-
Filesystem::tearDown();
706706
\OC_User::setUserId($user);
707707
\OC_Util::setupFS($user);
708708
Server::get(IRootFolder::class)->getUserFolder($user);

apps/files_versions/tests/VersioningTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use OCP\EventDispatcher\IEventDispatcher;
2626
use OCP\Files\IMimeTypeLoader;
2727
use OCP\Files\IRootFolder;
28+
use OCP\Files\ISetupManager;
2829
use OCP\IConfig;
2930
use OCP\IUser;
3031
use OCP\IUserManager;
@@ -971,9 +972,7 @@ public static function loginHelper(string $user, bool $create = false) {
971972
Server::get(IUserManager::class)->registerBackend($backend);
972973
}
973974

974-
\OC_Util::tearDownFS();
975-
\OC_User::setUserId('');
976-
Filesystem::tearDown();
975+
Server::get(ISetupManager::class)->tearDown();
977976
\OC_User::setUserId($user);
978977
\OC_Util::setupFS($user);
979978
Server::get(IRootFolder::class)->getUserFolder($user);

lib/private/Files/Filesystem.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ public static function getView(): ?View {
384384

385385
/**
386386
* tear down the filesystem, removing all storage providers
387+
* @deprecated 36.0.0 Use {@see \OCP\Files\ISetupManager::tearDown()} instead.
387388
*/
388389
public static function tearDown() {
389390
\OC_Util::tearDownFS();

lib/private/legacy/OC_Util.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public static function copyr($source, Folder $target) {
159159
}
160160

161161
/**
162-
* @deprecated 32.0.0 Call tearDown directly on SetupManager
162+
* @deprecated 32.0.0 Use {@see \OCP\Files\ISetupManager::tearDown()} instead.
163163
*/
164164
public static function tearDownFS(): void {
165165
$setupManager = Server::get(SetupManager::class);

tests/lib/HelperStorageTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use OC\Files\Storage\Storage;
1313
use OC\Files\Storage\Temporary;
1414
use OC\Files\Storage\Wrapper\Quota;
15+
use OCP\Files\ISetupManager;
1516
use OCP\Files\Mount\IMountManager;
1617
use OCP\IConfig;
1718
use OCP\Server;
@@ -40,7 +41,7 @@ protected function setUp(): void {
4041
$this->createUser($this->user, $this->user);
4142
$this->savedQuotaIncludeExternalStorage = $this->getIncludeExternalStorage();
4243

43-
Filesystem::tearDown();
44+
Server::get(ISetupManager::class)->tearDown();
4445
\OC_User::setUserId($this->user);
4546
Filesystem::init($this->user, '/' . $this->user . '/files');
4647

@@ -60,7 +61,7 @@ protected function tearDown(): void {
6061
$this->storageMock->getCache()->clear();
6162
$this->storageMock = null;
6263
}
63-
Filesystem::tearDown();
64+
Server::get(ISetupManager::class)->tearDown();
6465

6566
\OC_User::setUserId('');
6667
Server::get(IConfig::class)->deleteAllUserValues($this->user);

tests/lib/Security/CertificateManagerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use OC\Security\Certificate;
1717
use OC\Security\CertificateManager;
1818
use OCP\Files\InvalidPathException;
19+
use OCP\Files\ISetupManager;
1920
use OCP\IConfig;
2021
use OCP\IUserManager;
2122
use OCP\Security\ISecureRandom;
@@ -45,9 +46,8 @@ protected function setUp(): void {
4546
$storage = new Temporary();
4647
$this->registerMount($this->username, $storage, '/' . $this->username . '/');
4748

48-
\OC_Util::tearDownFS();
49+
Server::get(ISetupManager::class)->tearDown();
4950
\OC_User::setUserId($this->username);
50-
Filesystem::tearDown();
5151
\OC_Util::setupFS($this->username);
5252

5353
$config = $this->createMock(IConfig::class);

tests/lib/TestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,10 @@ protected static function tearDownAfterClassCleanStrayLocks(): void {
493493
*/
494494
protected static function loginAsUser(string $user = ''): void {
495495
self::logout();
496-
Filesystem::tearDown();
496+
$setupManager = Server::get(SetupManager::class);
497+
$setupManager->tearDown();
497498
\OC_User::setUserId($user);
498499
$userManager = Server::get(IUserManager::class);
499-
$setupManager = Server::get(SetupManager::class);
500500
$userObject = $userManager->get($user);
501501
if (!is_null($userObject)) {
502502
$userObject->updateLastLoginTimestamp();

0 commit comments

Comments
 (0)