diff options
author | Joas Schilling <coding@schilljs.com> | 2024-10-04 16:24:22 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2024-10-07 12:11:39 +0200 |
commit | 315e4658dd3694df144f708e42bb83073bc3b187 (patch) | |
tree | 72e126b46de05de97d290c28a3072f2aa6acee85 /tests | |
parent | e6cd1051dac570826c969c7e7372a38b192056fa (diff) | |
download | nextcloud-server-315e4658dd3694df144f708e42bb83073bc3b187.tar.gz nextcloud-server-315e4658dd3694df144f708e42bb83073bc3b187.zip |
test(settings): Correctly only return bool for Symfony Input::hasParameterOption callsdependabot/composer/symfony-6.4
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Core/Command/User/SettingTest.php | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/Core/Command/User/SettingTest.php b/tests/Core/Command/User/SettingTest.php index 95d1c192b81..62b75191d36 100644 --- a/tests/Core/Command/User/SettingTest.php +++ b/tests/Core/Command/User/SettingTest.php @@ -193,7 +193,16 @@ class SettingTest extends TestCase { ->willReturnMap($options); $this->consoleInput->expects($this->any()) ->method('hasParameterOption') - ->willReturnMap($parameterOptions); + ->willReturnCallback(function (string|array $config, bool $default = false) use ($parameterOptions): bool { + foreach ($parameterOptions as $parameterOption) { + if ($config === $parameterOption[0] + // Check the default value if the maps has 3 entries + && (!isset($parameterOption[2]) || $default === $parameterOption[1])) { + return end($parameterOption); + } + } + return false; + }); if ($user !== false) { $this->userManager->expects($this->once()) @@ -401,15 +410,16 @@ class SettingTest extends TestCase { if ($defaultValue === null) { $this->consoleInput->expects($this->atLeastOnce()) ->method('hasParameterOption') - ->willReturnMap([ - ['--default-value', false], - ]); + ->willReturn(false); } else { $this->consoleInput->expects($this->atLeastOnce()) ->method('hasParameterOption') - ->willReturnMap([ - ['--default-value', false, true], - ]); + ->willReturnCallback(function (string|array $config, bool $default = false): bool { + if ($config === '--default-value' && $default === false) { + return true; + } + return false; + }); $this->consoleInput->expects($this->once()) ->method('getOption') ->with('default-value') |