chore(tests): Adapt encryption tests to code changes

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/55060/head
Côme Chilliet 2025-08-25 15:37:36 +07:00 committed by Andy Scherzinger
parent 3c818c8f92
commit a889e29e6d
2 changed files with 4 additions and 10 deletions

@ -232,7 +232,7 @@ class EncryptionTest extends TestCase {
->willReturn(true);
$this->keyManagerMock->expects($this->once())
->method('getFileKey')
->with($path, 'user', null, true)
->with($path, null, null, true)
->willReturn($fileKey);
$this->instance->begin($path, 'user', 'r', [], []);

@ -352,15 +352,8 @@ class KeyManagerTest extends TestCase {
];
}
/**
*
* @param $uid
* @param $isMasterKeyEnabled
* @param $privateKey
* @param $expected
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataTestGetFileKey')]
public function testGetFileKey($uid, $isMasterKeyEnabled, $privateKey, $encryptedFileKey, $expected): void {
public function testGetFileKey(?string $uid, bool $isMasterKeyEnabled, string|false $privateKey, string $encryptedFileKey, string $expected): void {
$path = '/foo.txt';
if ($isMasterKeyEnabled) {
@ -374,6 +367,7 @@ class KeyManagerTest extends TestCase {
}
$this->invokePrivate($this->instance, 'masterKeyId', ['masterKeyId']);
$this->invokePrivate($this->instance, 'keyUid', [$uid]);
$this->keyStorageMock->expects($this->exactly(2))
->method('getFileKey')
@ -423,7 +417,7 @@ class KeyManagerTest extends TestCase {
}
$this->assertSame($expected,
$this->instance->getFileKey($path, $uid, null)
$this->instance->getFileKey($path, null, null)
);
}