EncryptionUploadTest.php 967 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
  8. use OC\Files\View;
  9. use Test\Traits\EncryptionTrait;
  10. /**
  11. * Class EncryptionUploadTest
  12. *
  13. * @group DB
  14. *
  15. * @package OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest
  16. */
  17. class EncryptionUploadTest extends UploadTest {
  18. use EncryptionTrait;
  19. protected function setupUser($name, $password) {
  20. $this->createUser($name, $password);
  21. $tmpFolder = \OC::$server->getTempManager()->getTemporaryFolder();
  22. $this->registerMount($name, '\OC\Files\Storage\Local', '/' . $name, ['datadir' => $tmpFolder]);
  23. // we use per-user keys
  24. \OC::$server->getConfig()->setAppValue('encryption', 'useMasterKey', '0');
  25. $this->setupForUser($name, $password);
  26. $this->loginWithEncryption($name);
  27. return new View('/' . $name . '/files');
  28. }
  29. }