add rahdar id to road item project
This commit is contained in:
97
tests/Feature/V3/RoadItemsProject/SupervisorIndexTest.php
Normal file
97
tests/Feature/V3/RoadItemsProject/SupervisorIndexTest.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\V3\RoadItemsProject;
|
||||
|
||||
use App\Models\Permission;
|
||||
use App\Models\RoadItemsProject;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SupervisorIndexTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase, WithFaker;
|
||||
/**
|
||||
* A basic feature test example.
|
||||
*/
|
||||
public function test_user_should_have_show_road_item_supervise_cartable_permission(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
$response = $this->actingAs($user)->getJson(route('v3.road_items.supervisorIndex'));
|
||||
|
||||
$response->assertForbidden();
|
||||
}
|
||||
|
||||
public function test_operator_can_see_the_data_table(): void
|
||||
{
|
||||
$user = User::factory()
|
||||
->has(Permission::factory([
|
||||
'name' => 'create-road-item'
|
||||
]))
|
||||
->create();
|
||||
|
||||
RoadItemsProject::factory(10)->create();
|
||||
|
||||
$response = $this->actingAs($user)->getJson(route('v3.road_items.operatorIndex', [
|
||||
'size' => 10,
|
||||
'start' => 0,
|
||||
'sorting' => json_encode([]),
|
||||
'filters' => json_encode([]),
|
||||
]));
|
||||
|
||||
$response->assertOk();
|
||||
|
||||
$response->assertJsonStructure([
|
||||
'data' => [
|
||||
'*' => [
|
||||
"id",
|
||||
"user_id",
|
||||
"start_lat",
|
||||
"start_lng",
|
||||
"end_lat",
|
||||
"end_lng",
|
||||
"project_distance",
|
||||
"item",
|
||||
"item_fa",
|
||||
"sub_item",
|
||||
"sub_item_fa",
|
||||
"sub_item_data",
|
||||
"sub_items",
|
||||
"sub_items_data",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"province_id",
|
||||
"province_fa",
|
||||
"city_id",
|
||||
"city_fa",
|
||||
"is_new",
|
||||
"parent_id",
|
||||
"start_way_id",
|
||||
"end_way_id",
|
||||
"unit_fa",
|
||||
"user_name",
|
||||
"created_at_fa",
|
||||
"info_id",
|
||||
"status",
|
||||
"status_fa",
|
||||
"edarat_id",
|
||||
"edarat_name",
|
||||
"edarat_type",
|
||||
"activity_date",
|
||||
"activity_time",
|
||||
"activity_date_time",
|
||||
"supervisor_id",
|
||||
"supervisor_name",
|
||||
"supervisor_description",
|
||||
"supervising_time",
|
||||
"cmms_machine_id",
|
||||
"cmms_machine_code",
|
||||
"rahdar_id",
|
||||
"rahdar_code",
|
||||
],
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user