seed(ProductionSetupSeeder::class); $this->admin = User::where('email', 'superadmin@gsb-cons.com')->first(); } public function test_ten_construction_classifications_are_seeded(): void { $this->assertDatabaseCount('project_classifications', 10); $expectedClassifications = [ 'road highway, pavement, railways, airport horizontal structures and bridges', 'irrigation and flood control', 'dam, reservoir, and tunneling', 'water supply', 'port, harbor and offshore engineering', 'building and industrial plant', 'sewerage treatment/disposal plant', 'water treatment plant and system', 'park, playground and recreational work', 'electrical work', ]; foreach ($expectedClassifications as $name) { $this->assertDatabaseHas('project_classifications', [ 'name' => $name, ]); } } public function test_project_can_be_created_with_multiple_classifications_tagging(): void { $selectedTags = [ 'road highway, pavement, railways, airport horizontal structures and bridges', 'electrical work', 'water supply', ]; $response = $this->actingAs($this->admin) ->post(route('projects.store'), [ 'name' => 'Mega Bypass & Substation Construction', 'project_type' => 'standard', 'contract_value' => 50000000, 'classifications' => $selectedTags, ]); $project = Project::where('name', 'Mega Bypass & Substation Construction')->first(); $this->assertNotNull($project); $this->assertEquals(2, $project->current_wizard_step); $this->assertIsArray($project->classifications); $this->assertCount(3, $project->classifications); $this->assertEquals($selectedTags, $project->classifications); $response->assertRedirect(route('projects.wizard', [$project, 'step' => 2])); } public function test_project_wizard_details_can_update_multiple_classifications(): void { $project = Project::factory()->create([ 'name' => 'Initial Project', 'project_type' => 'standard', 'classifications' => ['building and industrial plant'], 'current_wizard_step' => 1, ]); $updatedTags = [ 'building and industrial plant', 'sewerage treatment/disposal plant', 'water treatment plant and system', ]; $response = $this->actingAs($this->admin) ->post(route('projects.wizard.save-details', $project->ulid), [ 'name' => 'Updated Industrial Plant Project', 'project_type' => 'standard', 'classifications' => $updatedTags, ]); $response->assertRedirect(route('projects.wizard', [$project->fresh(), 'step' => 2])); $project->refresh(); $this->assertEquals('Updated Industrial Plant Project', $project->name); $this->assertCount(3, $project->classifications); $this->assertContains('sewerage treatment/disposal plant', $project->classifications); } }