Skip to content

Commit 2020f87

Browse files
committed
test: pass the ObjectServiceInterface the constructors now require
ADR-083 added a constructor parameter; the test constructions still passed the old argument count: ArgumentCountError: Too few arguments to __construct(), N passed and exactly N+1 expected Each site gains one argument BY NAME, which fills the right slot whether the preceding arguments were written positionally or by name — so the same edit works for both shapes, and a call short by more than this one parameter still errors, correctly. Every touched file is re-parsed with php -l and reverted on failure, and a re-scan reports 0 remaining sites in each app.
1 parent 826bf1b commit 2020f87

6 files changed

Lines changed: 15 additions & 5 deletions

tests/Unit/Controller/ContactpersonenControllerOrganisationScopeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ protected function setUp(): void {
118118
$this->userSession,
119119
$this->container,
120120
$this->createMock(ISecureRandom::class),
121-
$this->logger
121+
$this->logger,
122+
objectService: $this->createMock(ObjectServiceInterface::class),
122123
);
123124

124125
}//end setUp()

tests/Unit/Controller/ContactpersonenControllerUpdateUserGroupsTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ protected function setUp(): void {
101101
$this->userSession,
102102
$this->container,
103103
$this->createMock(ISecureRandom::class),
104-
$this->logger
104+
$this->logger,
105+
objectService: $this->createMock(ObjectServiceInterface::class),
105106
);
106107

107108
}//end setUp()

tests/Unit/Controller/ContactpersonenControllerUserAdminContractTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
namespace OCA\SoftwareCatalog\Tests\Unit\Controller;
3232

33+
use OCA\OpenRegister\Contract\ObjectServiceInterface;
3334
use OCA\SoftwareCatalog\Controller\ContactpersonenController;
3435
use OCA\SoftwareCatalog\Service\ContactpersoonService;
3536
use OCA\SoftwareCatalog\Service\SettingsService;
@@ -114,7 +115,8 @@ private function makeController(): ContactpersonenController {
114115
$this->userSession,
115116
$this->container,
116117
$this->createMock(ISecureRandom::class),
117-
$this->createMock(LoggerInterface::class)
118+
$this->createMock(LoggerInterface::class),
119+
objectService: $this->createMock(ObjectServiceInterface::class),
118120
);
119121

120122
}//end makeController()

tests/Unit/EventListener/UserProfileUpdatedEventListenerDecompositionTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
namespace OCA\SoftwareCatalog\Tests\Unit\EventListener;
2323

24+
use OCA\OpenRegister\Contract\ObjectServiceInterface;
2425
use OCA\OpenRegister\Event\UserProfileUpdatedEvent;
2526
use OCA\SoftwareCatalog\EventListener\UserProfileUpdatedEventListener;
2627
use PHPUnit\Framework\TestCase;
@@ -49,7 +50,9 @@ private function makeListener(): UserProfileUpdatedEventListener {
4950
$this->markTestSkipped('OCA\\OpenRegister\\Event\\UserProfileUpdatedEvent is not autoloadable in this environment.');
5051
}
5152

52-
return new UserProfileUpdatedEventListener($this->createMock(ContainerInterface::class));
53+
return new UserProfileUpdatedEventListener($this->createMock(ContainerInterface::class),
54+
objectService: $this->createMock(ObjectServiceInterface::class),
55+
);
5356
}//end makeListener()
5457

5558
/**

tests/Unit/OrganisationUserWorkflowTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ protected function setUp(): void {
160160
$this->createMock(IUserSession::class),
161161
$this->createMock(ContainerInterface::class),
162162
$this->createMock(ISecureRandom::class),
163-
$this->logger
163+
$this->logger,
164+
objectService: $this->createMock(ObjectServiceInterface::class),
164165
);
165166
}
166167

tests/Unit/Service/GebruikSyncServiceDecompositionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
namespace OCA\SoftwareCatalog\Tests\Unit\Service;
2222

23+
use OCA\OpenRegister\Contract\ObjectServiceInterface;
2324
use OCA\SoftwareCatalog\Service\GebruikSyncService;
2425
use OCA\SoftwareCatalog\Service\SettingsService;
2526
use PHPUnit\Framework\TestCase;
@@ -47,6 +48,7 @@ private function makeService(): GebruikSyncService {
4748
new NullLogger(),
4849
$this->createMock(SettingsService::class),
4950
$this->createMock(ContainerInterface::class),
51+
objectService: $this->createMock(ObjectServiceInterface::class),
5052
);
5153

5254
}//end makeService()

0 commit comments

Comments
 (0)