seed([RoleSeeder::class, SamplePsgcSeeder::class]); } public function test_lists_regions(): void { $response = $this->getJson('/api/v1/geo/regions'); $response->assertOk() ->assertJsonPath('success', true) ->assertJsonFragment(['code' => 'NCR']) ->assertJsonFragment(['code' => 'R03']); } public function test_lists_provinces_filtered_by_region(): void { $response = $this->getJson('/api/v1/geo/provinces?region=NCR'); $response->assertOk() ->assertJsonCount(4, 'data'); } public function test_lists_cities_filtered_by_province(): void { $response = $this->getJson('/api/v1/geo/cities?province=NCR-2'); $response->assertOk() ->assertJsonFragment(['code' => 'QC']) ->assertJsonFragment(['code' => 'PSG']); } public function test_lists_cities_filtered_by_region(): void { $response = $this->getJson('/api/v1/geo/cities?region=NCR'); $response->assertOk(); $this->assertGreaterThanOrEqual(5, count($response->json('data'))); } public function test_lists_barangays_filtered_by_city(): void { $response = $this->getJson('/api/v1/geo/barangays?city=QC'); $response->assertOk() ->assertJsonFragment(['name' => 'Diliman']) ->assertJsonFragment(['name' => 'Commonwealth']); } public function test_searches_barangays_by_name(): void { $response = $this->getJson('/api/v1/geo/barangays?q=Pob'); $response->assertOk() ->assertJsonFragment(['name' => 'Poblacion']); } public function test_invalid_region_filter_returns_empty(): void { $response = $this->getJson('/api/v1/geo/provinces?region=ZZZ'); $response->assertOk() ->assertJsonCount(0, 'data'); } }