aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Core/Command/Encryption/DecryptAllTest.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2025-05-02 14:00:10 +0200
committerJoas Schilling <coding@schilljs.com>2025-05-02 16:47:42 +0200
commitc24f5fb256f53836727d3479e0fcf79d680ca2ca (patch)
tree97e2ee14c40ed1cf2237eacd26f69375235e8419 /tests/Core/Command/Encryption/DecryptAllTest.php
parent9a16e4fd1407f0490136f6cfeec184be4b219dce (diff)
downloadnextcloud-server-test/noid/more-phpunit-10.tar.gz
nextcloud-server-test/noid/more-phpunit-10.zip
test: Finish migrating tests/Core/ to PHPUnit 10 compatible codetest/noid/more-phpunit-10
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/Core/Command/Encryption/DecryptAllTest.php')
-rw-r--r--tests/Core/Command/Encryption/DecryptAllTest.php39
1 files changed, 25 insertions, 14 deletions
diff --git a/tests/Core/Command/Encryption/DecryptAllTest.php b/tests/Core/Command/Encryption/DecryptAllTest.php
index 6ed4cbbea99..45b331efb59 100644
--- a/tests/Core/Command/Encryption/DecryptAllTest.php
+++ b/tests/Core/Command/Encryption/DecryptAllTest.php
@@ -73,12 +73,16 @@ class DecryptAllTest extends TestCase {
public function testMaintenanceAndTrashbin(): void {
// on construct we enable single-user-mode and disable the trash bin
// on destruct we disable single-user-mode again and enable the trash bin
+ $calls = [
+ ['maintenance', true],
+ ['maintenance', false],
+ ];
$this->config->expects($this->exactly(2))
->method('setSystemValue')
- ->withConsecutive(
- ['maintenance', true],
- ['maintenance', false],
- );
+ ->willReturnCallback(function () use (&$calls) {
+ $expected = array_shift($calls);
+ $this->assertEquals($expected, func_get_args());
+ });
$this->appManager->expects($this->once())
->method('disableApp')
->with('files_trashbin');
@@ -127,12 +131,16 @@ class DecryptAllTest extends TestCase {
->willReturn('user1');
if ($encryptionEnabled) {
+ $calls = [
+ ['core', 'encryption_enabled', 'no'],
+ ['core', 'encryption_enabled', 'yes'],
+ ];
$this->config->expects($this->exactly(2))
->method('setAppValue')
- ->withConsecutive(
- ['core', 'encryption_enabled', 'no'],
- ['core', 'encryption_enabled', 'yes'],
- );
+ ->willReturnCallback(function () use (&$calls) {
+ $expected = array_shift($calls);
+ $this->assertEquals($expected, func_get_args());
+ });
$this->questionHelper->expects($this->once())
->method('ask')
->willReturn($continue);
@@ -152,7 +160,7 @@ class DecryptAllTest extends TestCase {
$this->invokePrivate($instance, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
- public function dataTestExecute() {
+ public static function dataTestExecute(): array {
return [
[true, true],
[true, false],
@@ -174,13 +182,16 @@ class DecryptAllTest extends TestCase {
);
// make sure that we enable encryption again after a exception was thrown
+ $calls = [
+ ['core', 'encryption_enabled', 'no'],
+ ['core', 'encryption_enabled', 'yes'],
+ ];
$this->config->expects($this->exactly(2))
->method('setAppValue')
- ->withConsecutive(
- ['core', 'encryption_enabled', 'no'],
- ['core', 'encryption_enabled', 'yes'],
- );
-
+ ->willReturnCallback(function () use (&$calls) {
+ $expected = array_shift($calls);
+ $this->assertEquals($expected, func_get_args());
+ });
$this->encryptionManager->expects($this->once())
->method('isEnabled')
->willReturn(true);