seed(ProductionSetupSeeder::class); $this->admin = User::where('email', 'gimel.cantos@gmail.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', 'client_name' => 'Department of Public Works and Highways', 'location' => 'Davao City, Philippines', 'description' => 'Construction of bypass highway and electrical substation.', 'project_type' => 'standard', 'contract_value' => 50000000, 'start_date' => now()->addDays(10)->format('Y-m-d'), 'target_end_date' => now()->addYears(2)->format('Y-m-d'), 'contract_duration' => 730, 'pm_id' => $this->admin->id, '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', 'client_name' => 'San Miguel Corporation', 'location' => 'Batangas City', 'description' => 'Industrial water treatment and disposal facility expansion.', 'project_type' => 'standard', 'contract_value' => 25000000, 'start_date' => now()->addDays(5)->format('Y-m-d'), 'target_end_date' => now()->addMonths(12)->format('Y-m-d'), 'contract_duration' => 365, 'pm_id' => $this->admin->id, '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); } }