From c3aa195e1c4a1f82809c4a5daec09aab34a21166 Mon Sep 17 00:00:00 2001 From: Jana Peper Date: Wed, 11 Dec 2024 10:25:30 +0100 Subject: [PATCH] test: add disabled task type unit test Signed-off-by: Jana Peper --- tests/lib/TaskProcessing/TaskProcessingTest.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/lib/TaskProcessing/TaskProcessingTest.php b/tests/lib/TaskProcessing/TaskProcessingTest.php index 18fc4c9a8ff09..afcc9d0bf46c1 100644 --- a/tests/lib/TaskProcessing/TaskProcessingTest.php +++ b/tests/lib/TaskProcessing/TaskProcessingTest.php @@ -478,12 +478,16 @@ protected function setUp(): void { $taskProcessingTypeSettings[TextToText::ID] = false; $disabledConfig = $this->createMock(IConfig::class); - $disabledConfig->expects($this->any())->method('getAppValue') - ->with('core', 'ai.taskprocessing_type_preferences', '') - ->willReturn(json_encode($taskProcessingTypeSettings)); - $disabledConfig->expects($this->any())->method('getAppValue') - ->with('core', 'ai.taskprocessing_provider_preferences', '') - ->willReturn(''); + $disabledConfig + ->method('getAppValue') + ->willReturnCallback(function (string $appName, string $key) use ($taskProcessingTypeSettings) { + if ($key === 'ai.taskprocessing_provider_preferences') { + return ''; + } elseif ($key === 'ai.taskprocessing_type_preferences') { + return json_encode($taskProcessingTypeSettings); + } + return ''; + }); $this->disabledTypeManager = new Manager( $disabledConfig,