nextcloud/apps/files_sharing/tests/EncryptedSizePropagationTest.php
Stephen Cuppett b86fa0d0df fix(tests): Migrate EncryptionTrait and test files to typed IAppConfig
Update EncryptionTrait, EncryptionMasterKeyUploadTest, EncryptionUploadTest,
and EncryptedSizePropagationTest to use typed IAppConfig::setValueBool/
getValueBool for encryption_enabled and useMasterKey, preventing
AppConfigTypeConflictException when the keys are stored as BOOL type.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Stephen Cuppett <steve@cuppett.com>
2026-07-04 08:19:10 -04:00

43 lines
1.2 KiB
PHP

<?php
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCA\Files_Sharing\Tests;
use OC\Files\View;
use OCP\ITempManager;
use OCP\Server;
use Test\Traits\EncryptionTrait;
#[\PHPUnit\Framework\Attributes\Group(name: 'DB')]
class EncryptedSizePropagationTest extends SizePropagationTest {
use EncryptionTrait;
protected function setUp(): void {
parent::setUp();
$this->appConfig->setValueBool('encryption', 'useMasterKey', false);
}
protected function setupUser($name, $password = '') {
$this->createUser($name, $password);
$this->registerMountForUser($name);
$this->setupForUser($name, $password);
$this->loginWithEncryption($name);
return new View('/' . $name . '/files');
}
private function registerMountForUser($user): void {
$tmpFolder = Server::get(ITempManager::class)->getTemporaryFolder();
$this->registerMount($user, '\OC\Files\Storage\Local', '/' . $user, ['datadir' => $tmpFolder]);
}
protected function loginHelper($user, $create = false, $password = false) {
$this->registerMountForUser($user);
$this->setupForUser($user, $password);
parent::loginHelper($user, $create, $password);
}
}