From 7274b1b6491a1235a2193d410e8b356f013c89e7 Mon Sep 17 00:00:00 2001 From: Koen Eelen Date: Tue, 6 Aug 2024 11:32:31 +0200 Subject: [PATCH] fix test --- .../EloquentIntegrationRepositoryTest.php | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/Domain/Integrations/Repositories/EloquentIntegrationRepositoryTest.php b/tests/Domain/Integrations/Repositories/EloquentIntegrationRepositoryTest.php index a30d4b936..b05d60d79 100644 --- a/tests/Domain/Integrations/Repositories/EloquentIntegrationRepositoryTest.php +++ b/tests/Domain/Integrations/Repositories/EloquentIntegrationRepositoryTest.php @@ -16,6 +16,9 @@ use App\Domain\Integrations\KeyVisibility; use App\Domain\Integrations\Models\IntegrationModel; use App\Domain\Integrations\Repositories\EloquentIntegrationRepository; +use App\Domain\Integrations\Repositories\EloquentUdbOrganizerRepository; +use App\Domain\Integrations\UdbOrganizer; +use App\Domain\Integrations\UdbOrganizerCollection; use App\Domain\Integrations\Website; use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Foundation\Testing\RefreshDatabase; @@ -33,7 +36,9 @@ protected function setUp(): void { parent::setUp(); - $this->integrationRepository = new EloquentIntegrationRepository(); + $this->integrationRepository = new EloquentIntegrationRepository( + new EloquentUdbOrganizerRepository() + ); } public function test_it_can_save_an_integration(): void @@ -338,8 +343,16 @@ public function test_it_can_request_activation(): void $this->integrationRepository->save($searchIntegration); + $organizers = new UdbOrganizerCollection( + [new UdbOrganizer( + Uuid::uuid4(), + Uuid::uuid4(), + Uuid::uuid4()->toString(), + )], + ); + $organizationId = Uuid::uuid4(); - $this->integrationRepository->requestActivation($integrationId, $organizationId, null); + $this->integrationRepository->requestActivation($integrationId, $organizationId, null, $organizers); $this->assertDatabaseHas('integrations', [ 'id' => $searchIntegration->id->toString(), @@ -351,6 +364,14 @@ public function test_it_can_request_activation(): void 'status' => IntegrationStatus::PendingApprovalIntegration, ]); + foreach($organizers as $organizer) { + $this->assertDatabaseHas('udb_organizers', [ + 'id' => $organizer->id->toString(), + 'integration_id' => $organizer->integrationId->toString(), + 'organizer_id' => $organizer->organizerId, + ]); + } + Event::assertDispatched(IntegrationActivationRequested::class); }