aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Encryption/DecryptAllTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Encryption/DecryptAllTest.php')
-rw-r--r--tests/lib/Encryption/DecryptAllTest.php21
1 files changed, 9 insertions, 12 deletions
diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php
index 7385ff03785..979e12e03b3 100644
--- a/tests/lib/Encryption/DecryptAllTest.php
+++ b/tests/lib/Encryption/DecryptAllTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -44,7 +45,7 @@ class DecryptAllTest extends TestCase {
/** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */
protected $outputInterface;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\UserInterface */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|UserInterface */
protected $userInterface;
/** @var DecryptAll */
@@ -93,11 +94,11 @@ class DecryptAllTest extends TestCase {
}
/**
- * @dataProvider dataDecryptAll
* @param bool $prepareResult
* @param string $user
* @param bool $userExistsChecked
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataDecryptAll')]
public function testDecryptAll($prepareResult, $user, $userExistsChecked): void {
if ($userExistsChecked) {
$this->userManager->expects($this->once())->method('userExists')->willReturn(true);
@@ -153,9 +154,9 @@ class DecryptAllTest extends TestCase {
}
/**
- * @dataProvider dataTrueFalse
* @param bool $success
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTrueFalse')]
public function testPrepareEncryptionModules($success): void {
$user = 'user1';
@@ -185,9 +186,7 @@ class DecryptAllTest extends TestCase {
);
}
- /**
- * @dataProvider dataTestDecryptAllUsersFiles
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTestDecryptAllUsersFiles')]
public function testDecryptAllUsersFiles($user): void {
/** @var DecryptAll | \PHPUnit\Framework\MockObject\MockObject | $instance */
$instance = $this->getMockBuilder('OC\Encryption\DecryptAll')
@@ -217,7 +216,7 @@ class DecryptAllTest extends TestCase {
];
$instance->expects($this->exactly(2))
->method('decryptUsersFiles')
- ->willReturnCallback(function ($user) use (&$calls) {
+ ->willReturnCallback(function ($user) use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, $user);
});
@@ -297,7 +296,7 @@ class DecryptAllTest extends TestCase {
];
$instance->expects($this->exactly(2))
->method('decryptFile')
- ->willReturnCallback(function ($path) use (&$calls) {
+ ->willReturnCallback(function ($path) use (&$calls): void {
$expected = array_shift($calls);
$this->assertEquals($expected, $path);
});
@@ -317,9 +316,7 @@ class DecryptAllTest extends TestCase {
$this->invokePrivate($instance, 'decryptUsersFiles', ['user1', $progressBar, '']);
}
- /**
- * @dataProvider dataTrueFalse
- */
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataTrueFalse')]
public function testDecryptFile($isEncrypted): void {
$path = 'test.txt';
@@ -387,7 +384,7 @@ class DecryptAllTest extends TestCase {
$this->view->expects($this->once())
->method('copy')
->with($path, $path . '.decrypted.42')
- ->willReturnCallback(function () {
+ ->willReturnCallback(function (): void {
throw new DecryptionFailedException();
});