aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2025-06-26 14:02:13 +0200
committerCôme Chilliet <91878298+come-nc@users.noreply.github.com>2025-07-03 15:19:34 +0200
commit58e8626f5f331b5e28ea8658763493cac4dcf70c (patch)
tree0c845a687c64aeb32832e4b90238ace447f1e6ae
parent1285ebc3cfb2b1a68778e1d7ef7bd1a2b9989021 (diff)
downloadnextcloud-server-58e8626f5f331b5e28ea8658763493cac4dcf70c.tar.gz
nextcloud-server-58e8626f5f331b5e28ea8658763493cac4dcf70c.zip
chore: Adapt tests to new parameter in EncryptAll constructor
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r--apps/encryption/tests/Crypto/EncryptAllTest.php27
1 files changed, 18 insertions, 9 deletions
diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php
index 6dbbd55df78..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'])
@@ -275,7 +283,8 @@ class EncryptAllTest extends TestCase {
$this->l,
$this->l10nFactory,
$this->questionHelper,
- $this->secureRandom
+ $this->secureRandom,
+ $this->logger,
]
)
->onlyMethods(['encryptFile', 'setupUserFS'])