2016-11-15 11:25:28 -05:00
|
|
|
<?php
|
2025-06-30 09:04:05 -04:00
|
|
|
|
2016-11-15 11:25:28 -05:00
|
|
|
/**
|
2024-05-10 09:09:14 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2016-11-15 11:25:28 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace Test\Lockdown\Filesystem;
|
|
|
|
|
|
2021-12-01 15:40:14 -05:00
|
|
|
use OC\Authentication\Token\PublicKeyToken;
|
2016-11-15 11:25:28 -05:00
|
|
|
use OC\Files\Filesystem;
|
|
|
|
|
use OC\Lockdown\Filesystem\NullStorage;
|
2024-03-15 07:51:31 -04:00
|
|
|
use OCP\Authentication\Token\IToken;
|
2025-06-12 12:31:58 -04:00
|
|
|
use OCP\Server;
|
2016-11-15 11:25:28 -05:00
|
|
|
use Test\Traits\UserTrait;
|
|
|
|
|
|
2025-10-20 19:52:40 -04:00
|
|
|
#[\PHPUnit\Framework\Attributes\Group('DB')]
|
2016-11-15 11:25:28 -05:00
|
|
|
class NoFSTest extends \Test\TestCase {
|
|
|
|
|
use UserTrait;
|
|
|
|
|
|
2019-11-27 09:27:18 -05:00
|
|
|
protected function tearDown(): void {
|
2021-12-01 15:40:14 -05:00
|
|
|
$token = new PublicKeyToken();
|
2016-11-15 11:25:28 -05:00
|
|
|
$token->setScope([
|
2024-03-15 07:51:31 -04:00
|
|
|
IToken::SCOPE_FILESYSTEM => true
|
2016-11-15 11:25:28 -05:00
|
|
|
]);
|
2025-06-12 12:31:58 -04:00
|
|
|
Server::get('LockdownManager')->setToken($token);
|
2019-11-21 10:40:38 -05:00
|
|
|
parent::tearDown();
|
2016-11-15 11:25:28 -05:00
|
|
|
}
|
|
|
|
|
|
2019-11-27 09:27:18 -05:00
|
|
|
protected function setUp(): void {
|
2016-11-15 11:25:28 -05:00
|
|
|
parent::setUp();
|
2021-12-01 15:40:14 -05:00
|
|
|
$token = new PublicKeyToken();
|
2016-11-15 11:25:28 -05:00
|
|
|
$token->setScope([
|
2024-03-15 07:51:31 -04:00
|
|
|
IToken::SCOPE_FILESYSTEM => false
|
2016-11-15 11:25:28 -05:00
|
|
|
]);
|
|
|
|
|
|
2025-06-12 12:31:58 -04:00
|
|
|
Server::get('LockdownManager')->setToken($token);
|
2016-11-15 11:25:28 -05:00
|
|
|
$this->createUser('foo', 'var');
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-15 16:32:31 -04:00
|
|
|
public function testSetupFS(): void {
|
2016-11-15 11:25:28 -05:00
|
|
|
\OC_Util::tearDownFS();
|
|
|
|
|
\OC_Util::setupFS('foo');
|
|
|
|
|
|
|
|
|
|
$this->assertInstanceOf(NullStorage::class, Filesystem::getStorage('/foo/files'));
|
|
|
|
|
}
|
|
|
|
|
}
|