NoFSTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace Test\Lockdown\Filesystem;
  7. use OC\Authentication\Token\PublicKeyToken;
  8. use OC\Files\Filesystem;
  9. use OC\Lockdown\Filesystem\NullStorage;
  10. use OCP\Authentication\Token\IToken;
  11. use Test\Traits\UserTrait;
  12. /**
  13. * @group DB
  14. */
  15. class NoFSTest extends \Test\TestCase {
  16. use UserTrait;
  17. protected function tearDown(): void {
  18. $token = new PublicKeyToken();
  19. $token->setScope([
  20. IToken::SCOPE_FILESYSTEM => true
  21. ]);
  22. \OC::$server->get('LockdownManager')->setToken($token);
  23. parent::tearDown();
  24. }
  25. protected function setUp(): void {
  26. parent::setUp();
  27. $token = new PublicKeyToken();
  28. $token->setScope([
  29. IToken::SCOPE_FILESYSTEM => false
  30. ]);
  31. \OC::$server->get('LockdownManager')->setToken($token);
  32. $this->createUser('foo', 'var');
  33. }
  34. public function testSetupFS(): void {
  35. \OC_Util::tearDownFS();
  36. \OC_Util::setupFS('foo');
  37. $this->assertInstanceOf(NullStorage::class, Filesystem::getStorage('/foo/files'));
  38. }
  39. }