create(['role' => 'user']); $response = $this->actingAs($user)->post(route('admin.pages.store'), [ 'title' => 'Summer Fest', 'thank_you_message' => null, 'expired_message' => null, 'ticketshop_url' => null, 'start_date' => '2026-06-01T10:00', 'end_date' => '2026-06-30T18:00', 'is_active' => true, ]); $this->assertDatabaseCount('preregistration_pages', 1); $page = PreregistrationPage::query()->first(); $response->assertRedirect(route('admin.pages.edit', $page)); $this->assertSame('Summer Fest', $page?->title); $this->assertFalse($page?->background_fixed); $this->assertGreaterThanOrEqual(4, PageBlock::query()->where('preregistration_page_id', $page?->id)->count()); } public function test_store_can_enable_fixed_background(): void { $user = User::factory()->create(['role' => 'user']); $response = $this->actingAs($user)->post(route('admin.pages.store'), [ 'title' => 'Winter Fest', 'thank_you_message' => null, 'expired_message' => null, 'ticketshop_url' => null, 'start_date' => '2026-06-01T10:00', 'end_date' => '2026-06-30T18:00', 'is_active' => true, 'background_fixed' => true, ]); $page = PreregistrationPage::query()->where('title', 'Winter Fest')->first(); $response->assertRedirect(route('admin.pages.edit', $page)); $this->assertNotNull($page); $this->assertTrue($page->background_fixed); } 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' => '', 'start_date' => '2026-06-30T10:00', 'end_date' => '2026-06-01T10:00', ]); $response->assertRedirect(route('admin.pages.create')); $response->assertSessionHasErrors('title'); } }