Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Koen Eelen committed Aug 6, 2024
1 parent 1bb94bc commit 7274b1b
Showing 1 changed file with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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(),
Expand All @@ -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);
}

Expand Down

0 comments on commit 7274b1b

Please sign in to comment.