Skip to content

Commit daf9fb8

Browse files
authored
fix(tests): Register OCA service in the correct container
It’s not supported anymore to register OCA services directly in the core container. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent cad2eb1 commit daf9fb8

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎tests/lib/Settings/DeclarativeManagerTest.php‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,8 @@ public function testSetValueWithHandler(): void {
583583
->method('setValue')
584584
->with('test_field_2', 'some password', $this->adminUser);
585585

586-
\OC::$server->registerService('OCA\\Testing\\Settings\\DeclarativeForm', fn () => $form, false);
586+
$appContainer = \OC::$server->getAppContainerForService('OCA\\Testing\\Settings\\DeclarativeForm');
587+
$appContainer->registerService('OCA\\Testing\\Settings\\DeclarativeForm', fn () => $form, false);
587588

588589
$context = $this->createMock(RegistrationContext::class);
589590
$context->expects(self::atLeastOnce())
@@ -616,7 +617,8 @@ public function testGetValueWithHandler(): void {
616617
->with('test_field_2', $this->adminUser)
617618
->willReturn('very secret password');
618619

619-
\OC::$server->registerService('OCA\\Testing\\Settings\\DeclarativeForm', fn () => $form, false);
620+
$appContainer = \OC::$server->getAppContainerForService('OCA\\Testing\\Settings\\DeclarativeForm');
621+
$appContainer->registerService('OCA\\Testing\\Settings\\DeclarativeForm', fn () => $form, false);
620622

621623
$context = $this->createMock(RegistrationContext::class);
622624
$context->expects(self::atLeastOnce())

0 commit comments

Comments
 (0)