create(['role' => 'user']); $response = $this->actingAs($user)->post(route('admin.pages.store'), [ 'title' => 'Summer Fest', 'heading' => 'Register', 'intro_text' => null, 'thank_you_message' => null, 'expired_message' => null, 'ticketshop_url' => null, 'start_date' => '2026-06-01T10:00', 'end_date' => '2026-06-30T18:00', 'phone_enabled' => false, 'is_active' => true, ]); $response->assertRedirect(route('admin.pages.index')); $this->assertDatabaseCount('preregistration_pages', 1); $this->assertSame('Summer Fest', PreregistrationPage::query()->first()?->title); } public function test_validation_failure_redirects_back_with_input(): void { $user = User::factory()->create(['role' => 'user']); $response = $this->actingAs($user)->from(route('admin.pages.create'))->post(route('admin.pages.store'), [ 'title' => '', 'heading' => 'H', 'start_date' => '2026-06-30T10:00', 'end_date' => '2026-06-01T10:00', ]); $response->assertRedirect(route('admin.pages.create')); $response->assertSessionHasErrors('title'); $response->assertSessionHasInput('heading', 'H'); } }