diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php index 64ab7bfbeaf..9f59aee8812 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionMasterKeyUploadTest.php @@ -10,7 +10,7 @@ declare(strict_types=1); namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest; use OC\Files\View; -use OCP\IConfig; +use OCP\IAppConfig; use OCP\ITempManager; use OCP\Server; use Test\Traits\EncryptionTrait; @@ -30,7 +30,7 @@ class EncryptionMasterKeyUploadTest extends UploadTest { $tmpFolder = Server::get(ITempManager::class)->getTemporaryFolder(); $this->registerMount($name, '\OC\Files\Storage\Local', '/' . $name, ['datadir' => $tmpFolder]); // we use the master key - Server::get(IConfig::class)->setAppValue('encryption', 'useMasterKey', '1'); + Server::get(IAppConfig::class)->setValueBool('encryption', 'useMasterKey', true); $this->setupForUser($name, $password); $this->loginWithEncryption($name); return new View('/' . $name . '/files'); diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php index 4baab8927d0..8cb0dfd2f08 100644 --- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/EncryptionUploadTest.php @@ -10,7 +10,7 @@ declare(strict_types=1); namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest; use OC\Files\View; -use OCP\IConfig; +use OCP\IAppConfig; use OCP\ITempManager; use OCP\Server; use Test\Traits\EncryptionTrait; @@ -30,7 +30,7 @@ class EncryptionUploadTest extends UploadTest { $tmpFolder = Server::get(ITempManager::class)->getTemporaryFolder(); $this->registerMount($name, '\OC\Files\Storage\Local', '/' . $name, ['datadir' => $tmpFolder]); // we use per-user keys - Server::get(IConfig::class)->setAppValue('encryption', 'useMasterKey', '0'); + Server::get(IAppConfig::class)->setValueBool('encryption', 'useMasterKey', false); $this->setupForUser($name, $password); $this->loginWithEncryption($name); return new View('/' . $name . '/files'); diff --git a/apps/files_sharing/tests/EncryptedSizePropagationTest.php b/apps/files_sharing/tests/EncryptedSizePropagationTest.php index fc3ff77f687..9434e9061eb 100644 --- a/apps/files_sharing/tests/EncryptedSizePropagationTest.php +++ b/apps/files_sharing/tests/EncryptedSizePropagationTest.php @@ -19,7 +19,7 @@ class EncryptedSizePropagationTest extends SizePropagationTest { protected function setUp(): void { parent::setUp(); - $this->config->setAppValue('encryption', 'useMasterKey', '0'); + $this->appConfig->setValueBool('encryption', 'useMasterKey', false); } protected function setupUser($name, $password = '') { diff --git a/tests/lib/Traits/EncryptionTrait.php b/tests/lib/Traits/EncryptionTrait.php index 7a553120bea..7b3c016d522 100644 --- a/tests/lib/Traits/EncryptionTrait.php +++ b/tests/lib/Traits/EncryptionTrait.php @@ -18,6 +18,7 @@ use OCA\Encryption\Users\Setup; use OCP\App\IAppManager; use OCP\Encryption\IManager; use OCP\Files\ISetupManager; +use OCP\IAppConfig; use OCP\IConfig; use OCP\IUserManager; use OCP\IUserSession; @@ -47,6 +48,8 @@ trait EncryptionTrait { */ private $config; + private IAppConfig $appConfig; + /** * @var Application */ @@ -108,16 +111,17 @@ trait EncryptionTrait { $this->encryptionApp = new Application([], $isReady); $this->config = Server::get(IConfig::class); - $this->encryptionWasEnabled = $this->config->getAppValue('core', 'encryption_enabled', 'no'); + $this->appConfig = Server::get(IAppConfig::class); + $this->encryptionWasEnabled = $this->appConfig->getValueBool('core', 'encryption_enabled'); $this->originalEncryptionModule = $this->config->getAppValue('core', 'default_encryption_module'); $this->config->setAppValue('core', 'default_encryption_module', Encryption::ID); - $this->config->setAppValue('core', 'encryption_enabled', 'yes'); + $this->appConfig->setValueBool('core', 'encryption_enabled', true); $this->assertTrue(Server::get(\OCP\Encryption\IManager::class)->isEnabled()); } protected function tearDownEncryptionTrait() { if ($this->config) { - $this->config->setAppValue('core', 'encryption_enabled', $this->encryptionWasEnabled); + $this->appConfig->setValueBool('core', 'encryption_enabled', $this->encryptionWasEnabled); $this->config->setAppValue('core', 'default_encryption_module', $this->originalEncryptionModule); $this->config->deleteAppValue('encryption', 'useMasterKey'); }