2424use OCP \Files \File ;
2525use OCP \Files \IRootFolder ;
2626use OCP \Http \Client \IClientService ;
27+ use OCP \IAppConfig ;
2728use OCP \ICacheFactory ;
2829use OCP \IConfig ;
2930use OCP \IDBConnection ;
@@ -535,6 +536,7 @@ class TaskProcessingTest extends \Test\TestCase {
535536 private IUserMountCache $ userMountCache ;
536537 private IRootFolder $ rootFolder ;
537538 private IConfig $ config ;
539+ private IAppConfig $ appConfig ;
538540
539541 public const TEST_USER = 'testuser ' ;
540542
@@ -600,8 +602,9 @@ protected function setUp(): void {
600602
601603 $ this ->userMountCache = $ this ->createMock (IUserMountCache::class);
602604 $ this ->config = Server::get (IConfig::class);
605+ $ this ->appConfig = Server::get (IAppConfig::class);
603606 $ this ->manager = new Manager (
604- $ this ->config ,
607+ $ this ->appConfig ,
605608 $ this ->coordinator ,
606609 $ this ->serverContainer ,
607610 Server::get (LoggerInterface::class),
@@ -641,7 +644,7 @@ public function testProviderShouldBeRegisteredAndTaskTypeDisabled(): void {
641644 $ taskProcessingTypeSettings = [
642645 TextToText::ID => false ,
643646 ];
644- $ this ->config -> setAppValue ('core ' , 'ai.taskprocessing_type_preferences ' , json_encode ($ taskProcessingTypeSettings ));
647+ $ this ->appConfig -> setValueString ('core ' , 'ai.taskprocessing_type_preferences ' , json_encode ($ taskProcessingTypeSettings ), lazy: true );
645648 self ::assertCount (0 , $ this ->manager ->getAvailableTaskTypes ());
646649 self ::assertCount (1 , $ this ->manager ->getAvailableTaskTypes (true ));
647650 self ::assertTrue ($ this ->manager ->hasProviders ());
@@ -651,7 +654,7 @@ public function testProviderShouldBeRegisteredAndTaskTypeDisabled(): void {
651654
652655
653656 public function testProviderShouldBeRegisteredAndTaskFailValidation (): void {
654- $ this ->config -> setAppValue ('core ' , 'ai.taskprocessing_type_preferences ' , '' );
657+ $ this ->appConfig -> setValueString ('core ' , 'ai.taskprocessing_type_preferences ' , '' , lazy: true );
655658 $ this ->registrationContext ->expects ($ this ->any ())->method ('getTaskProcessingProviders ' )->willReturn ([
656659 new ServiceRegistration ('test ' , BrokenSyncProvider::class)
657660 ]);
@@ -797,7 +800,7 @@ public function testTaskTypeExplicitlyEnabled(): void {
797800 $ taskProcessingTypeSettings = [
798801 TextToText::ID => true ,
799802 ];
800- $ this ->config -> setAppValue ('core ' , 'ai.taskprocessing_type_preferences ' , json_encode ($ taskProcessingTypeSettings ));
803+ $ this ->appConfig -> setValueString ('core ' , 'ai.taskprocessing_type_preferences ' , json_encode ($ taskProcessingTypeSettings ), lazy: true );
801804
802805 self ::assertCount (1 , $ this ->manager ->getAvailableTaskTypes ());
803806
@@ -1239,7 +1242,7 @@ public function testMergeTaskTypesLocalAndEvent() {
12391242
12401243 private function createManagerInstance (): Manager {
12411244 // Clear potentially cached config values if needed
1242- $ this ->config -> deleteAppValue ('core ' , 'ai.taskprocessing_type_preferences ' );
1245+ $ this ->appConfig -> deleteKey ('core ' , 'ai.taskprocessing_type_preferences ' );
12431246
12441247 // Re-create Text2ImageManager if its state matters or mocks change
12451248 $ text2imageManager = new \OC \TextToImage \Manager (
@@ -1253,7 +1256,7 @@ private function createManagerInstance(): Manager {
12531256 );
12541257
12551258 return new Manager (
1256- $ this ->config ,
1259+ $ this ->appConfig ,
12571260 $ this ->coordinator ,
12581261 $ this ->serverContainer ,
12591262 Server::get (LoggerInterface::class),
0 commit comments