2016-04-20 08:58:43 -04:00
|
|
|
<?php
|
2025-06-30 09:04:05 -04:00
|
|
|
|
2016-04-20 08:58:43 -04:00
|
|
|
/**
|
2024-06-06 13:48:28 -04:00
|
|
|
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2016-04-20 08:58:43 -04:00
|
|
|
*/
|
2016-05-17 05:42:03 -04:00
|
|
|
namespace OCA\Files_Sharing\Tests;
|
2016-04-20 08:58:43 -04:00
|
|
|
|
|
|
|
|
use OC\Files\View;
|
2025-02-03 09:34:01 -05:00
|
|
|
use OCP\ITempManager;
|
|
|
|
|
use OCP\Server;
|
2016-04-20 08:58:43 -04:00
|
|
|
use Test\Traits\EncryptionTrait;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @group DB
|
|
|
|
|
*/
|
2016-05-17 05:42:03 -04:00
|
|
|
class EncryptedSizePropagationTest extends SizePropagationTest {
|
2016-04-20 08:58:43 -04:00
|
|
|
use EncryptionTrait;
|
|
|
|
|
|
2025-05-13 07:11:37 -04:00
|
|
|
protected function setUp(): void {
|
|
|
|
|
parent::setUp();
|
2024-11-28 06:08:57 -05:00
|
|
|
$this->config->setAppValue('encryption', 'useMasterKey', '0');
|
2025-05-13 07:11:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function setupUser($name, $password = '') {
|
2016-04-20 08:58:43 -04:00
|
|
|
$this->createUser($name, $password);
|
2025-05-19 02:56:13 -04:00
|
|
|
$this->registerMountForUser($name);
|
2016-04-20 08:58:43 -04:00
|
|
|
$this->setupForUser($name, $password);
|
|
|
|
|
$this->loginWithEncryption($name);
|
|
|
|
|
return new View('/' . $name . '/files');
|
|
|
|
|
}
|
2024-11-28 06:08:57 -05:00
|
|
|
|
2025-05-19 02:56:13 -04:00
|
|
|
private function registerMountForUser($user): void {
|
|
|
|
|
$tmpFolder = Server::get(ITempManager::class)->getTemporaryFolder();
|
|
|
|
|
$this->registerMount($user, '\OC\Files\Storage\Local', '/' . $user, ['datadir' => $tmpFolder]);
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-28 06:08:57 -05:00
|
|
|
protected function loginHelper($user, $create = false, $password = false) {
|
2025-05-19 02:56:13 -04:00
|
|
|
$this->registerMountForUser($user);
|
2024-11-28 06:08:57 -05:00
|
|
|
$this->setupForUser($user, $password);
|
|
|
|
|
parent::loginHelper($user, $create, $password);
|
|
|
|
|
}
|
2016-04-20 08:58:43 -04:00
|
|
|
}
|