2015-09-08 09:35:30 -04:00
|
|
|
<?php
|
2024-05-28 06:34:11 -04:00
|
|
|
|
2025-05-27 17:36:08 -04:00
|
|
|
declare(strict_types=1);
|
2015-09-08 09:35:30 -04:00
|
|
|
/**
|
2024-05-28 06:34:11 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2015-09-08 09:35:30 -04:00
|
|
|
*/
|
2016-05-25 10:04:15 -04:00
|
|
|
namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
|
2015-09-08 09:35:30 -04:00
|
|
|
|
|
|
|
|
use OC\Files\View;
|
2025-02-03 09:34:01 -05:00
|
|
|
use OCP\IConfig;
|
|
|
|
|
use OCP\ITempManager;
|
|
|
|
|
use OCP\Server;
|
2015-09-08 09:35:30 -04:00
|
|
|
use Test\Traits\EncryptionTrait;
|
|
|
|
|
|
2015-11-20 05:27:11 -05:00
|
|
|
/**
|
|
|
|
|
* Class EncryptionUploadTest
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @package OCA\DAV\Tests\Unit\Connector\Sabre\RequestTest
|
|
|
|
|
*/
|
2026-01-07 08:21:48 -05:00
|
|
|
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
|
2015-09-08 09:35:30 -04:00
|
|
|
class EncryptionUploadTest extends UploadTest {
|
|
|
|
|
use EncryptionTrait;
|
|
|
|
|
|
2025-05-27 17:36:08 -04:00
|
|
|
protected function setupUser($name, $password): View {
|
2015-09-08 09:35:30 -04:00
|
|
|
$this->createUser($name, $password);
|
2025-02-03 09:34:01 -05:00
|
|
|
$tmpFolder = Server::get(ITempManager::class)->getTemporaryFolder();
|
2015-09-08 09:35:30 -04:00
|
|
|
$this->registerMount($name, '\OC\Files\Storage\Local', '/' . $name, ['datadir' => $tmpFolder]);
|
2017-05-31 09:03:37 -04:00
|
|
|
// we use per-user keys
|
2025-02-03 09:34:01 -05:00
|
|
|
Server::get(IConfig::class)->setAppValue('encryption', 'useMasterKey', '0');
|
2015-09-08 09:35:30 -04:00
|
|
|
$this->setupForUser($name, $password);
|
|
|
|
|
$this->loginWithEncryption($name);
|
|
|
|
|
return new View('/' . $name . '/files');
|
|
|
|
|
}
|
|
|
|
|
}
|