seed(SiteContentSeeder::class); $this->get('/')->assertOk()->assertSee('Digital experiences built to move your business forward.'); SiteSection::where('key','hero')->update(['is_visible'=>false]); $this->get('/')->assertOk()->assertDontSee('Digital experiences built to move your business forward.'); } public function test_contact_form_validates_and_saves_enquiry(): void { Livewire::test(ContactForm::class)->set('name','Test Client')->set('email','client@example.com') ->set('message','Please build a Laravel website for my business.')->call('submit')->assertHasNoErrors(); $this->assertDatabaseHas('contact_enquiries',['email'=>'client@example.com','is_read'=>false]); } public function test_guests_cannot_open_admin_dashboard(): void { $this->get('/admin')->assertRedirect(route('login')); } public function test_non_admin_cannot_access_admin_pages(): void { $this->actingAs(User::factory()->create())->get('/admin')->assertForbidden(); } public function test_admin_can_edit_site_content(): void { $admin=User::factory()->create(['is_admin'=>true]); $this->actingAs($admin); Livewire::test(Sections::class)->set('key','hero')->set('title','A better digital future') ->set('body','Custom messaging')->set('is_visible',true)->call('save')->assertHasNoErrors(); $this->assertDatabaseHas('site_sections',['key'=>'hero','title'=>'A better digital future']); } public function test_dedicated_public_pages_render_with_navigation_and_content(): void { foreach (['services' => 'Digital services', 'expertise' => 'Deep engineering', 'approach' => 'A clear process'] as $url => $heading) { $this->get('/'.$url)->assertOk()->assertSee($heading)->assertSee('Capability with purpose'); } } public function test_homepage_navigation_links_to_dedicated_pages(): void { $this->seed(SiteContentSeeder::class); $this->get('/')->assertOk()->assertSee('href="'.route('services').'"', false) ->assertSee('href="'.route('expertise').'"', false) ->assertSee('href="'.route('approach').'"', false); } public function test_honeypot_rejects_spam(): void { Livewire::test(ContactForm::class)->set('name','Spam')->set('email','spam@example.com') ->set('message','Spam message example')->set('website','spambot')->call('submit')->assertHasErrors(['website']); $this->assertSame(0,ContactEnquiry::count()); } }