create(); $survey = Survey::create([ 'title' => 'Test Survey', 'date' => '2025-01-01', 'user_id' => $user->id, ]); $this->assertNotEmpty($survey->uuid); $this->assertTrue(Str::isUuid($survey->uuid)); } public function test_public_can_access_survey_via_uuid(): void { $user = User::factory()->create(); $survey = Survey::create([ 'title' => 'UUID Survey', 'date' => '2025-01-01', 'user_id' => $user->id, ]); $response = $this->get(route('surveys.show', $survey)); // Should use UUID $response->assertStatus(200); $response->assertSee('UUID Survey'); } public function test_public_cannot_access_survey_via_id(): void { $user = User::factory()->create(); $survey = Survey::create([ 'title' => 'ID Survey', 'date' => '2025-01-01', 'user_id' => $user->id, ]); // Construct URL manually with ID $response = $this->get('/survey/' . $survey->id); $response->assertStatus(404); } }