nextcloud/tests/lib/Lockdown/Filesystem/NoFSTest.php
Côme Chilliet 32f8ff2445
fix: Remove uses of deprecated service string names
Use the class/interface name instead to avoid logging.
This was breaking in some cases as logging would trigger a deprecation
 warning, resulting in an infinite loop.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2026-06-22 11:19:00 +02:00

50 lines
1.2 KiB
PHP

<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace Test\Lockdown\Filesystem;
use OC\Authentication\Token\PublicKeyToken;
use OC\Files\Filesystem;
use OC\Lockdown\Filesystem\NullStorage;
use OCP\Authentication\Token\IToken;
use OCP\Lockdown\ILockdownManager;
use OCP\Server;
use Test\Traits\UserTrait;
#[\PHPUnit\Framework\Attributes\Group('DB')]
class NoFSTest extends \Test\TestCase {
use UserTrait;
#[\Override]
protected function tearDown(): void {
$token = new PublicKeyToken();
$token->setScope([
IToken::SCOPE_FILESYSTEM => true
]);
Server::get(ILockdownManager::class)->setToken($token);
parent::tearDown();
}
#[\Override]
protected function setUp(): void {
parent::setUp();
$token = new PublicKeyToken();
$token->setScope([
IToken::SCOPE_FILESYSTEM => false
]);
Server::get(ILockdownManager::class)->setToken($token);
$this->createUser('foo', 'var');
}
public function testSetupFS(): void {
\OC_Util::tearDownFS();
\OC_Util::setupFS('foo');
$this->assertInstanceOf(NullStorage::class, Filesystem::getStorage('/foo/files'));
}
}