Skip to content

Commit

Permalink
test: add disabled task type unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Jana Peper <[email protected]>
  • Loading branch information
janepie committed Dec 11, 2024
1 parent a8e7aef commit c3aa195
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tests/lib/TaskProcessing/TaskProcessingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c3aa195

Please sign in to comment.