get('/forms/nablus-workshop') ->assertOk() ->assertDontSee('x-navigation', false) ->assertDontSee('x-footer', false); }); test('navigation and footer components do not link to the workshop page', function () { $navigation = file_get_contents(resource_path('views/components/navigation.blade.php')); $footer = file_get_contents(resource_path('views/components/footer.blade.php')); expect($navigation)->not->toContain('nablus-workshop'); expect($footer)->not->toContain('nablus-workshop'); }); test('valid submission with blank email sends workshop registration mail and redirects to about', function () { Volt::test('pages.forms.nablus-workshop') ->set('fullName', 'سارة أحمد') ->set('contactNumber', '0599123456') ->set('email', '') ->call('register') ->assertHasNoErrors() ->assertRedirect(route('about')); Mail::assertQueued(WorkshopRegistrationMail::class, function ($mail) { return $mail->fullName === 'سارة أحمد' && $mail->contactNumber === '0599123456' && $mail->email === null; }); }); test('blank full name fails validation and does not send mail', function () { Volt::test('pages.forms.nablus-workshop') ->set('fullName', '') ->set('contactNumber', '0599123456') ->call('register') ->assertHasErrors(['fullName']); Mail::assertNothingSent(); Mail::assertNothingQueued(); }); test('blank contact number fails validation and does not send mail', function () { Volt::test('pages.forms.nablus-workshop') ->set('fullName', 'سارة أحمد') ->set('contactNumber', '') ->call('register') ->assertHasErrors(['contactNumber']); Mail::assertNothingSent(); Mail::assertNothingQueued(); }); test('invalid email fails validation and does not send mail', function () { Volt::test('pages.forms.nablus-workshop') ->set('fullName', 'سارة أحمد') ->set('contactNumber', '0599123456') ->set('email', 'not-an-email') ->call('register') ->assertHasErrors(['email']); Mail::assertNothingSent(); Mail::assertNothingQueued(); }); test('valid email is passed through to the mailable', function () { Volt::test('pages.forms.nablus-workshop') ->set('fullName', 'سارة أحمد') ->set('contactNumber', '0599123456') ->set('email', 'sara@example.com') ->call('register') ->assertHasNoErrors(); Mail::assertQueued(WorkshopRegistrationMail::class, function ($mail) { return $mail->email === 'sara@example.com'; }); });