rating()->create([ 'title' => 'Laravel', 'description' => 'Framework expertise', 'rating' => 8, ]); $personalium = Personalia::factory()->hidden()->create([ 'key' => 'Email', 'value' => 'roberto@example.com', 'icon' => 'fa-solid fa-envelope', ]); $education = Education::factory()->create([ 'opleiding' => 'HBO-ICT', 'instituut' => 'Hogeschool Utrecht', 'startdatum' => '2020-09-01', 'einddatum' => '2024-07-01', ]); $experience = WorkExperience::factory()->current()->create([ 'werkgever' => 'Acme', 'functie' => 'Developer', 'startdatum' => '2022-01-01', ]); $this->get(route('home')) ->assertOk() ->assertViewIs('welcome') ->assertViewHas('skills', fn ($skills) => $skills->get('rating')->contains($skill)) ->assertViewHas('personalia', fn ($personalia) => $personalia->contains($personalium)) ->assertViewHas('education', fn ($educations) => $educations->contains($education)) ->assertViewHas('experience', fn ($experiences) => $experiences->contains($experience)); }); test('a hidden personalia value can be requested and the click is queued for notification', function () { Queue::fake(); $personalium = Personalia::factory()->hidden()->create([ 'key' => 'Email', 'value' => 'roberto@example.com', 'icon' => 'fa-solid fa-envelope', ]); $this->withHeader('User-Agent', 'Pest Browser') ->getJson(route('personalia', $personalium)) ->assertOk() ->assertJson([ 'value' => 'roberto@example.com', ]); Queue::assertPushed(NotifyTelegramAboutPersonaliaClick::class); }); test('requesting unknown personalia returns not found', function () { Queue::fake(); $this->getJson(route('personalia', 999))->assertNotFound(); Queue::assertNotPushed(NotifyTelegramAboutPersonaliaClick::class); }); test('a contact message can be submitted and is queued for notification', function () { Queue::fake(); $this->withHeader('User-Agent', 'Pest Browser') ->postJson(route('contact'), [ 'name' => 'Roberto', 'email' => 'roberto@example.com', 'phone' => '+31612345678', 'message' => 'Hoi, ik wil graag contact opnemen.', ]) ->assertOk() ->assertJson([ 'status' => 'success', ]); Queue::assertPushed(NotifyTelegramAboutContactMessage::class); }); test('a contact message requires a name and message', function () { Queue::fake(); $this->postJson(route('contact'), [ 'email' => 'not-an-email', ]) ->assertUnprocessable() ->assertJsonValidationErrors(['name', 'message', 'email']); Queue::assertNotPushed(NotifyTelegramAboutContactMessage::class); });