create(); $response = $this->actingAs($user)->getJson(route('v3.road_items.supervisorIndex')); $response->assertForbidden(); } public function test_user_cannot_access_authentication_to_supervisor_index(): void { $response = $this->getJson(route('v3.road_items.supervisorIndex')); $response->assertStatus(401); } public function test_supervisor_can_see_the_data_table(): void { $user = User::factory() ->has(Permission::factory([ 'name' => 'show-road-item-supervise-cartable' ])) ->create(); RoadItemsProject::factory(10)->create(); $response = $this->actingAs($user)->getJson(route('v3.road_items.supervisorIndex', [ 'size' => 10, 'start' => 0, 'sorting' => json_encode([]), 'filters' => json_encode([]), ])); $response->assertOk(); $response->assertJsonStructure([ 'data' => [ '*' => [ "id", "start_lat", "start_lng", "end_lat", "end_lng", "item", "item_fa", "sub_item_fa", "sub_item_data", "created_at", "province_fa", "unit_fa", "status", "status_fa", "edarat_name", "activity_date_time", "can_supervise", ], ] ]); } }