get(route('contact')); $response->assertStatus(200); $response->assertSee('Contactformulier'); } public function test_contact_form_can_be_submitted() { ValidationRule::macro('friendlycaptcha', function () { return new class implements Rule { public function passes($attribute, $value) { return true; } public function message() { return 'The :attribute is invalid.'; } }; }); Mail::fake(); Storage::fake('public'); $image = UploadedFile::fake()->image('example.jpg'); $video = UploadedFile::fake()->create('example.mp4', 1000, 'video/mp4'); $response = $this->post(route('contact.submit'), [ 'name' => 'Test User', 'email' => 'test@example.com', 'message' => 'Dit is een testbericht.', 'image' => $image, 'video' => $video, 'frc-captcha-solution' => 'dummy-solution', ]); $response->assertRedirect(route('contact')); $response->assertSessionHas('success'); Mail::assertSent(function (ContactFormSubmitted $mail) { return $mail->hasTo('info@nhgooi.nl'); }); } }