aboutsummaryrefslogtreecommitdiffstats
path: root/apps/encryption
diff options
context:
space:
mode:
Diffstat (limited to 'apps/encryption')
-rw-r--r--apps/encryption/lib/Crypto/EncryptAll.php28
-rw-r--r--apps/encryption/tests/Command/TestEnableMasterKey.php4
-rw-r--r--apps/encryption/tests/Controller/RecoveryControllerTest.php6
-rw-r--r--apps/encryption/tests/Controller/StatusControllerTest.php2
-rw-r--r--apps/encryption/tests/Crypto/CryptTest.php26
-rw-r--r--apps/encryption/tests/Crypto/DecryptAllTest.php2
-rw-r--r--apps/encryption/tests/Crypto/EncryptAllTest.php33
-rw-r--r--apps/encryption/tests/Crypto/EncryptionTest.php13
-rw-r--r--apps/encryption/tests/KeyManagerTest.php16
-rw-r--r--apps/encryption/tests/SessionTest.php2
-rw-r--r--apps/encryption/tests/Settings/AdminTest.php4
-rw-r--r--apps/encryption/tests/Users/SetupTest.php2
-rw-r--r--apps/encryption/tests/UtilTest.php6
13 files changed, 78 insertions, 66 deletions
diff --git a/apps/encryption/lib/Crypto/EncryptAll.php b/apps/encryption/lib/Crypto/EncryptAll.php
index 6dfa36e6e3d..d9db616e6f1 100644
--- a/apps/encryption/lib/Crypto/EncryptAll.php
+++ b/apps/encryption/lib/Crypto/EncryptAll.php
@@ -20,6 +20,7 @@ use OCP\L10N\IFactory;
use OCP\Mail\Headers\AutoSubmitted;
use OCP\Mail\IMailer;
use OCP\Security\ISecureRandom;
+use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Helper\Table;
@@ -50,6 +51,7 @@ class EncryptAll {
protected IFactory $l10nFactory,
protected QuestionHelper $questionHelper,
protected ISecureRandom $secureRandom,
+ protected LoggerInterface $logger,
) {
// store one time passwords for the users
$this->userPasswords = [];
@@ -207,9 +209,22 @@ class EncryptAll {
} else {
$progress->setMessage("encrypt files for user $userCount: $path");
$progress->advance();
- if ($this->encryptFile($path) === false) {
- $progress->setMessage("encrypt files for user $userCount: $path (already encrypted)");
+ try {
+ if ($this->encryptFile($path) === false) {
+ $progress->setMessage("encrypt files for user $userCount: $path (already encrypted)");
+ $progress->advance();
+ }
+ } catch (\Exception $e) {
+ $progress->setMessage("Failed to encrypt path $path: " . $e->getMessage());
$progress->advance();
+ $this->logger->error(
+ 'Failed to encrypt path {path}',
+ [
+ 'user' => $uid,
+ 'path' => $path,
+ 'exception' => $e,
+ ]
+ );
}
}
}
@@ -234,7 +249,14 @@ class EncryptAll {
$target = $path . '.encrypted.' . time();
try {
- $this->rootView->copy($source, $target);
+ $copySuccess = $this->rootView->copy($source, $target);
+ if ($copySuccess === false) {
+ /* Copy failed, abort */
+ if ($this->rootView->file_exists($target)) {
+ $this->rootView->unlink($target);
+ }
+ throw new \Exception('Copy failed for ' . $source);
+ }
$this->rootView->rename($target, $source);
} catch (DecryptionFailedException $e) {
if ($this->rootView->file_exists($target)) {
diff --git a/apps/encryption/tests/Command/TestEnableMasterKey.php b/apps/encryption/tests/Command/TestEnableMasterKey.php
index 744bbaed6f8..ead3dfd0195 100644
--- a/apps/encryption/tests/Command/TestEnableMasterKey.php
+++ b/apps/encryption/tests/Command/TestEnableMasterKey.php
@@ -55,11 +55,11 @@ class TestEnableMasterKey extends TestCase {
}
/**
- * @dataProvider dataTestExecute
*
* @param bool $isAlreadyEnabled
* @param string $answer
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestExecute')]
public function testExecute($isAlreadyEnabled, $answer): void {
$this->util->expects($this->once())->method('isMasterKeyEnabled')
->willReturn($isAlreadyEnabled);
@@ -81,7 +81,7 @@ class TestEnableMasterKey extends TestCase {
$this->invokePrivate($this->enableMasterKey, 'execute', [$this->input, $this->output]);
}
- public function dataTestExecute() {
+ public static function dataTestExecute() {
return [
[true, ''],
[false, 'y'],
diff --git a/apps/encryption/tests/Controller/RecoveryControllerTest.php b/apps/encryption/tests/Controller/RecoveryControllerTest.php
index 7eff312d6ce..0fec3f4d6a9 100644
--- a/apps/encryption/tests/Controller/RecoveryControllerTest.php
+++ b/apps/encryption/tests/Controller/RecoveryControllerTest.php
@@ -37,13 +37,13 @@ class RecoveryControllerTest extends TestCase {
}
/**
- * @dataProvider adminRecoveryProvider
* @param $recoveryPassword
* @param $passConfirm
* @param $enableRecovery
* @param $expectedMessage
* @param $expectedStatus
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('adminRecoveryProvider')]
public function testAdminRecovery($recoveryPassword, $passConfirm, $enableRecovery, $expectedMessage, $expectedStatus): void {
$this->recoveryMock->expects($this->any())
->method('enableAdminRecovery')
@@ -73,13 +73,13 @@ class RecoveryControllerTest extends TestCase {
}
/**
- * @dataProvider changeRecoveryPasswordProvider
* @param $password
* @param $confirmPassword
* @param $oldPassword
* @param $expectedMessage
* @param $expectedStatus
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('changeRecoveryPasswordProvider')]
public function testChangeRecoveryPassword($password, $confirmPassword, $oldPassword, $expectedMessage, $expectedStatus): void {
$this->recoveryMock->expects($this->any())
->method('changeRecoveryKeyPassword')
@@ -105,11 +105,11 @@ class RecoveryControllerTest extends TestCase {
}
/**
- * @dataProvider userSetRecoveryProvider
* @param $enableRecovery
* @param $expectedMessage
* @param $expectedStatus
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('userSetRecoveryProvider')]
public function testUserSetRecovery($enableRecovery, $expectedMessage, $expectedStatus): void {
$this->recoveryMock->expects($this->any())
->method('setRecoveryForUser')
diff --git a/apps/encryption/tests/Controller/StatusControllerTest.php b/apps/encryption/tests/Controller/StatusControllerTest.php
index 616114927e8..1bbcad77411 100644
--- a/apps/encryption/tests/Controller/StatusControllerTest.php
+++ b/apps/encryption/tests/Controller/StatusControllerTest.php
@@ -50,11 +50,11 @@ class StatusControllerTest extends TestCase {
}
/**
- * @dataProvider dataTestGetStatus
*
* @param string $status
* @param string $expectedStatus
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetStatus')]
public function testGetStatus($status, $expectedStatus): void {
$this->sessionMock->expects($this->once())
->method('getStatus')->willReturn($status);
diff --git a/apps/encryption/tests/Crypto/CryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php
index 345311da4d0..1355e2c855d 100644
--- a/apps/encryption/tests/Crypto/CryptTest.php
+++ b/apps/encryption/tests/Crypto/CryptTest.php
@@ -80,9 +80,8 @@ class CryptTest extends TestCase {
/**
* test generateHeader with valid key formats
- *
- * @dataProvider dataTestGenerateHeader
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGenerateHeader')]
public function testGenerateHeader($keyFormat, $expected): void {
$this->config->expects($this->once())
->method('getSystemValueString')
@@ -130,10 +129,10 @@ class CryptTest extends TestCase {
}
/**
- * @dataProvider dataProviderGetCipher
* @param string $configValue
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderGetCipher')]
public function testGetCipher($configValue, $expected): void {
$this->config->expects($this->once())
->method('getSystemValueString')
@@ -173,9 +172,7 @@ class CryptTest extends TestCase {
);
}
- /**
- * @dataProvider dataTestSplitMetaData
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSplitMetaData')]
public function testSplitMetaData($data, $expected): void {
$this->config->method('getSystemValueBool')
->with('encryption_skip_signature_check', false)
@@ -200,9 +197,7 @@ class CryptTest extends TestCase {
];
}
- /**
- * @dataProvider dataTestHasSignature
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestHasSignature')]
public function testHasSignature($data, $expected): void {
$this->config->method('getSystemValueBool')
->with('encryption_skip_signature_check', false)
@@ -219,9 +214,7 @@ class CryptTest extends TestCase {
];
}
- /**
- * @dataProvider dataTestHasSignatureFail
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestHasSignatureFail')]
public function testHasSignatureFail($cipher): void {
$this->expectException(GenericEncryptionException::class);
@@ -249,10 +242,10 @@ class CryptTest extends TestCase {
/**
* test removePadding()
*
- * @dataProvider dataProviderRemovePadding
* @param $data
* @param $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderRemovePadding')]
public function testRemovePadding($data, $expected): void {
$result = self::invokePrivate($this->crypt, 'removePadding', [$data]);
$this->assertSame($expected, $result);
@@ -327,9 +320,8 @@ class CryptTest extends TestCase {
/**
* test return values of valid ciphers
- *
- * @dataProvider dataTestGetKeySize
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetKeySize')]
public function testGetKeySize($cipher, $expected): void {
$result = $this->invokePrivate($this->crypt, 'getKeySize', [$cipher]);
$this->assertSame($expected, $result);
@@ -354,9 +346,7 @@ class CryptTest extends TestCase {
];
}
- /**
- * @dataProvider dataTestDecryptPrivateKey
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestDecryptPrivateKey')]
public function testDecryptPrivateKey($header, $privateKey, $expectedCipher, $isValidKey, $expected): void {
$this->config->method('getSystemValueBool')
->willReturnMap([
diff --git a/apps/encryption/tests/Crypto/DecryptAllTest.php b/apps/encryption/tests/Crypto/DecryptAllTest.php
index 83684b8be32..82e6100bce5 100644
--- a/apps/encryption/tests/Crypto/DecryptAllTest.php
+++ b/apps/encryption/tests/Crypto/DecryptAllTest.php
@@ -59,11 +59,11 @@ class DecryptAllTest extends TestCase {
}
/**
- * @dataProvider dataTestGetPrivateKey
*
* @param string $user
* @param string $recoveryKeyId
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetPrivateKey')]
public function testGetPrivateKey($user, $recoveryKeyId, $masterKeyId): void {
$password = 'passwd';
$recoveryKey = 'recoveryKey';
diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php
index 45743ae733b..9b39c62b650 100644
--- a/apps/encryption/tests/Crypto/EncryptAllTest.php
+++ b/apps/encryption/tests/Crypto/EncryptAllTest.php
@@ -23,6 +23,7 @@ use OCP\Mail\IMailer;
use OCP\Security\ISecureRandom;
use OCP\UserInterface;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Helper\QuestionHelper;
@@ -46,6 +47,7 @@ class EncryptAllTest extends TestCase {
protected \Symfony\Component\Console\Output\OutputInterface&MockObject $outputInterface;
protected UserInterface&MockObject $userInterface;
protected ISecureRandom&MockObject $secureRandom;
+ protected LoggerInterface&MockObject $logger;
protected EncryptAll $encryptAll;
@@ -76,6 +78,7 @@ class EncryptAllTest extends TestCase {
->disableOriginalConstructor()->getMock();
$this->userInterface = $this->getMockBuilder(UserInterface::class)
->disableOriginalConstructor()->getMock();
+ $this->logger = $this->createMock(LoggerInterface::class);
/**
* We need format method to return a string
@@ -106,12 +109,13 @@ class EncryptAllTest extends TestCase {
$this->l,
$this->l10nFactory,
$this->questionHelper,
- $this->secureRandom
+ $this->secureRandom,
+ $this->logger,
);
}
public function testEncryptAll(): void {
- /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */
+ /** @var EncryptAll&MockObject $encryptAll */
$encryptAll = $this->getMockBuilder(EncryptAll::class)
->setConstructorArgs(
[
@@ -125,7 +129,8 @@ class EncryptAllTest extends TestCase {
$this->l,
$this->l10nFactory,
$this->questionHelper,
- $this->secureRandom
+ $this->secureRandom,
+ $this->logger,
]
)
->onlyMethods(['createKeyPairs', 'encryptAllUsersFiles', 'outputPasswords'])
@@ -140,7 +145,7 @@ class EncryptAllTest extends TestCase {
}
public function testEncryptAllWithMasterKey(): void {
- /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */
+ /** @var EncryptAll&MockObject $encryptAll */
$encryptAll = $this->getMockBuilder(EncryptAll::class)
->setConstructorArgs(
[
@@ -154,7 +159,8 @@ class EncryptAllTest extends TestCase {
$this->l,
$this->l10nFactory,
$this->questionHelper,
- $this->secureRandom
+ $this->secureRandom,
+ $this->logger,
]
)
->onlyMethods(['createKeyPairs', 'encryptAllUsersFiles', 'outputPasswords'])
@@ -170,7 +176,7 @@ class EncryptAllTest extends TestCase {
}
public function testCreateKeyPairs(): void {
- /** @var EncryptAll | \PHPUnit\Framework\MockObject\MockObject $encryptAll */
+ /** @var EncryptAll&MockObject $encryptAll */
$encryptAll = $this->getMockBuilder(EncryptAll::class)
->setConstructorArgs(
[
@@ -184,7 +190,8 @@ class EncryptAllTest extends TestCase {
$this->l,
$this->l10nFactory,
$this->questionHelper,
- $this->secureRandom
+ $this->secureRandom,
+ $this->logger,
]
)
->onlyMethods(['setupUserFS', 'generateOneTimePassword'])
@@ -234,7 +241,8 @@ class EncryptAllTest extends TestCase {
$this->l,
$this->l10nFactory,
$this->questionHelper,
- $this->secureRandom
+ $this->secureRandom,
+ $this->logger,
]
)
->onlyMethods(['encryptUsersFiles'])
@@ -249,7 +257,7 @@ class EncryptAllTest extends TestCase {
$encryptAllCalls = [];
$encryptAll->expects($this->exactly(2))
->method('encryptUsersFiles')
- ->willReturnCallback(function ($uid) use (&$encryptAllCalls) {
+ ->willReturnCallback(function ($uid) use (&$encryptAllCalls): void {
$encryptAllCalls[] = $uid;
});
@@ -275,7 +283,8 @@ class EncryptAllTest extends TestCase {
$this->l,
$this->l10nFactory,
$this->questionHelper,
- $this->secureRandom
+ $this->secureRandom,
+ $this->logger,
]
)
->onlyMethods(['encryptFile', 'setupUserFS'])
@@ -317,7 +326,7 @@ class EncryptAllTest extends TestCase {
$encryptAllCalls = [];
$encryptAll->expects($this->exactly(2))
->method('encryptFile')
- ->willReturnCallback(function (string $path) use (&$encryptAllCalls) {
+ ->willReturnCallback(function (string $path) use (&$encryptAllCalls): void {
$encryptAllCalls[] = $path;
});
@@ -346,9 +355,9 @@ class EncryptAllTest extends TestCase {
}
/**
- * @dataProvider dataTestEncryptFile
* @param $isEncrypted
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestEncryptFile')]
public function testEncryptFile($isEncrypted): void {
$fileInfo = $this->createMock(FileInfo::class);
$fileInfo->expects($this->any())->method('isEncrypted')
diff --git a/apps/encryption/tests/Crypto/EncryptionTest.php b/apps/encryption/tests/Crypto/EncryptionTest.php
index 999c6242f0c..37e484550ef 100644
--- a/apps/encryption/tests/Crypto/EncryptionTest.php
+++ b/apps/encryption/tests/Crypto/EncryptionTest.php
@@ -152,9 +152,7 @@ class EncryptionTest extends TestCase {
return $publicKeys;
}
- /**
- * @dataProvider dataProviderForTestGetPathToRealFile
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderForTestGetPathToRealFile')]
public function testGetPathToRealFile($path, $expected): void {
$this->assertSame($expected,
self::invokePrivate($this->instance, 'getPathToRealFile', [$path])
@@ -170,9 +168,7 @@ class EncryptionTest extends TestCase {
];
}
- /**
- * @dataProvider dataTestBegin
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestBegin')]
public function testBegin($mode, $header, $legacyCipher, $defaultCipher, $fileKey, $expected): void {
$this->sessionMock->expects($this->once())
->method('decryptAllModeActivated')
@@ -265,11 +261,11 @@ class EncryptionTest extends TestCase {
}
/**
- * @dataProvider dataTestUpdate
*
* @param string $fileKey
* @param boolean $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestUpdate')]
public function testUpdate($fileKey, $expected): void {
$this->keyManagerMock->expects($this->once())
->method('getFileKey')->willReturn($fileKey);
@@ -354,9 +350,8 @@ class EncryptionTest extends TestCase {
/**
* by default the encryption module should encrypt regular files, files in
* files_versions and files in files_trashbin
- *
- * @dataProvider dataTestShouldEncrypt
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestShouldEncrypt')]
public function testShouldEncrypt($path, $shouldEncryptHomeStorage, $isHomeStorage, $expected): void {
$this->utilMock->expects($this->once())->method('shouldEncryptHomeStorage')
->willReturn($shouldEncryptHomeStorage);
diff --git a/apps/encryption/tests/KeyManagerTest.php b/apps/encryption/tests/KeyManagerTest.php
index 187c21bc687..3fe76fc4f59 100644
--- a/apps/encryption/tests/KeyManagerTest.php
+++ b/apps/encryption/tests/KeyManagerTest.php
@@ -166,9 +166,7 @@ class KeyManagerTest extends TestCase {
);
}
- /**
- * @dataProvider dataTestUserHasKeys
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestUserHasKeys')]
public function testUserHasKeys($key, $expected): void {
$this->keyStorageMock->expects($this->exactly(2))
->method('getUserKey')
@@ -221,10 +219,9 @@ class KeyManagerTest extends TestCase {
}
/**
- * @dataProvider dataTestInit
- *
* @param bool $useMasterKey
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestInit')]
public function testInit($useMasterKey): void {
/** @var KeyManager&MockObject $instance */
$instance = $this->getMockBuilder(KeyManager::class)
@@ -248,7 +245,7 @@ class KeyManagerTest extends TestCase {
$sessionSetStatusCalls = [];
$this->sessionMock->expects($this->exactly(2))
->method('setStatus')
- ->willReturnCallback(function (string $status) use (&$sessionSetStatusCalls) {
+ ->willReturnCallback(function (string $status) use (&$sessionSetStatusCalls): void {
$sessionSetStatusCalls[] = $status;
});
@@ -356,13 +353,13 @@ class KeyManagerTest extends TestCase {
}
/**
- * @dataProvider dataTestGetFileKey
*
* @param $uid
* @param $isMasterKeyEnabled
* @param $privateKey
* @param $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetFileKey')]
public function testGetFileKey($uid, $isMasterKeyEnabled, $privateKey, $encryptedFileKey, $expected): void {
$path = '/foo.txt';
@@ -452,13 +449,13 @@ class KeyManagerTest extends TestCase {
/**
* test add public share key and or recovery key to the list of public keys
*
- * @dataProvider dataTestAddSystemKeys
*
* @param array $accessList
* @param array $publicKeys
* @param string $uid
* @param array $expectedKeys
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestAddSystemKeys')]
public function testAddSystemKeys($accessList, $publicKeys, $uid, $expectedKeys): void {
$publicShareKeyId = 'publicShareKey';
$recoveryKeyId = 'recoveryKey';
@@ -539,10 +536,9 @@ class KeyManagerTest extends TestCase {
}
/**
- * @dataProvider dataTestValidateMasterKey
- *
* @param $masterKey
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestValidateMasterKey')]
public function testValidateMasterKey($masterKey): void {
/** @var KeyManager&MockObject $instance */
$instance = $this->getMockBuilder(KeyManager::class)
diff --git a/apps/encryption/tests/SessionTest.php b/apps/encryption/tests/SessionTest.php
index 9e38f857e73..986502749c8 100644
--- a/apps/encryption/tests/SessionTest.php
+++ b/apps/encryption/tests/SessionTest.php
@@ -115,11 +115,11 @@ class SessionTest extends TestCase {
}
/**
- * @dataProvider dataTestIsReady
*
* @param int $status
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsReady')]
public function testIsReady($status, $expected): void {
/** @var Session&MockObject $instance */
$instance = $this->getMockBuilder(Session::class)
diff --git a/apps/encryption/tests/Settings/AdminTest.php b/apps/encryption/tests/Settings/AdminTest.php
index 5ae9e7eb3c6..8355cdf6729 100644
--- a/apps/encryption/tests/Settings/AdminTest.php
+++ b/apps/encryption/tests/Settings/AdminTest.php
@@ -53,7 +53,7 @@ class AdminTest extends TestCase {
public function testGetForm(): void {
$this->config
->method('getAppValue')
- ->will($this->returnCallback(function ($app, $key, $default) {
+ ->willReturnCallback(function ($app, $key, $default) {
if ($app === 'encryption' && $key === 'recoveryAdminEnabled' && $default === '0') {
return '1';
}
@@ -61,7 +61,7 @@ class AdminTest extends TestCase {
return '1';
}
return $default;
- }));
+ });
$params = [
'recoveryEnabled' => '1',
'initStatus' => '0',
diff --git a/apps/encryption/tests/Users/SetupTest.php b/apps/encryption/tests/Users/SetupTest.php
index b2abfcba1db..6b2b8b4cad5 100644
--- a/apps/encryption/tests/Users/SetupTest.php
+++ b/apps/encryption/tests/Users/SetupTest.php
@@ -46,11 +46,11 @@ class SetupTest extends TestCase {
}
/**
- * @dataProvider dataTestSetupUser
*
* @param bool $hasKeys
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSetupUser')]
public function testSetupUser($hasKeys, $expected): void {
$this->keyManagerMock->expects($this->once())->method('userHasKeys')
->with('uid')->willReturn($hasKeys);
diff --git a/apps/encryption/tests/UtilTest.php b/apps/encryption/tests/UtilTest.php
index 3556b9e34c1..41860a44ffb 100644
--- a/apps/encryption/tests/UtilTest.php
+++ b/apps/encryption/tests/UtilTest.php
@@ -115,11 +115,11 @@ class UtilTest extends TestCase {
}
/**
- * @dataProvider dataTestIsMasterKeyEnabled
*
* @param string $value
* @param bool $expect
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestIsMasterKeyEnabled')]
public function testIsMasterKeyEnabled($value, $expect): void {
$this->configMock->expects($this->once())->method('getAppValue')
->with('encryption', 'useMasterKey', '1')->willReturn($value);
@@ -136,10 +136,10 @@ class UtilTest extends TestCase {
}
/**
- * @dataProvider dataTestShouldEncryptHomeStorage
* @param string $returnValue return value from getAppValue()
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestShouldEncryptHomeStorage')]
public function testShouldEncryptHomeStorage($returnValue, $expected): void {
$this->configMock->expects($this->once())->method('getAppValue')
->with('encryption', 'encryptHomeStorage', '1')
@@ -157,10 +157,10 @@ class UtilTest extends TestCase {
}
/**
- * @dataProvider dataTestSetEncryptHomeStorage
* @param $value
* @param $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestSetEncryptHomeStorage')]
public function testSetEncryptHomeStorage($value, $expected): void {
$this->configMock->expects($this->once())->method('setAppValue')
->with('encryption', 'encryptHomeStorage', $expected);