worker api
This commit is contained in:
parent
045b8d1f4c
commit
4ba8fac200
@ -208,7 +208,7 @@ public function index(Request $request)
|
|||||||
[
|
[
|
||||||
'id' => 2,
|
'id' => 2,
|
||||||
'name' => 'Housekeeper (Indian, 1500-2000 AED)',
|
'name' => 'Housekeeper (Indian, 1500-2000 AED)',
|
||||||
'query' => 'category=Housekeeping&nationality=India&max_salary=2000'
|
'query' => 'category=Housekeeping&nationality=Indian&max_salary=2000'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ public function run(): void
|
|||||||
'name' => 'John Doe',
|
'name' => 'John Doe',
|
||||||
'email' => 'john.doe@example.com',
|
'email' => 'john.doe@example.com',
|
||||||
'phone' => '+971 50 111 2222',
|
'phone' => '+971 50 111 2222',
|
||||||
'nationality' => 'India',
|
'nationality' => 'Indian',
|
||||||
'country' => 'United Arab Emirates',
|
'country' => 'United Arab Emirates',
|
||||||
'city' => 'Dubai',
|
'city' => 'Dubai',
|
||||||
'area' => 'Dubai Marina',
|
'area' => 'Dubai Marina',
|
||||||
@ -39,7 +39,7 @@ public function run(): void
|
|||||||
'name' => 'Ali Hassan',
|
'name' => 'Ali Hassan',
|
||||||
'email' => 'ali.hassan@example.com',
|
'email' => 'ali.hassan@example.com',
|
||||||
'phone' => '+971 50 333 4444',
|
'phone' => '+971 50 333 4444',
|
||||||
'nationality' => 'Pakistan',
|
'nationality' => 'Pakistani',
|
||||||
'country' => 'United Arab Emirates',
|
'country' => 'United Arab Emirates',
|
||||||
'city' => 'Dubai',
|
'city' => 'Dubai',
|
||||||
'area' => 'Al Barsha',
|
'area' => 'Al Barsha',
|
||||||
@ -61,7 +61,7 @@ public function run(): void
|
|||||||
'name' => 'Maria Santos',
|
'name' => 'Maria Santos',
|
||||||
'email' => 'maria.santos@example.com',
|
'email' => 'maria.santos@example.com',
|
||||||
'phone' => '+971 50 555 6666',
|
'phone' => '+971 50 555 6666',
|
||||||
'nationality' => 'Philippines',
|
'nationality' => 'Filipino',
|
||||||
'country' => 'United Arab Emirates',
|
'country' => 'United Arab Emirates',
|
||||||
'city' => 'Abu Dhabi',
|
'city' => 'Abu Dhabi',
|
||||||
'area' => 'Yas Island',
|
'area' => 'Yas Island',
|
||||||
@ -83,7 +83,7 @@ public function run(): void
|
|||||||
'name' => 'Lakshmi Sharma',
|
'name' => 'Lakshmi Sharma',
|
||||||
'email' => 'lakshmi.sharma@example.com',
|
'email' => 'lakshmi.sharma@example.com',
|
||||||
'phone' => '+971 50 777 8888',
|
'phone' => '+971 50 777 8888',
|
||||||
'nationality' => 'India',
|
'nationality' => 'Indian',
|
||||||
'country' => 'United Arab Emirates',
|
'country' => 'United Arab Emirates',
|
||||||
'city' => 'Abu Dhabi',
|
'city' => 'Abu Dhabi',
|
||||||
'area' => 'Khalifa City',
|
'area' => 'Khalifa City',
|
||||||
@ -105,7 +105,7 @@ public function run(): void
|
|||||||
'name' => 'Siti Aminah',
|
'name' => 'Siti Aminah',
|
||||||
'email' => 'siti.aminah@example.com',
|
'email' => 'siti.aminah@example.com',
|
||||||
'phone' => '+971 50 999 0000',
|
'phone' => '+971 50 999 0000',
|
||||||
'nationality' => 'Indonesia',
|
'nationality' => 'Indonesian',
|
||||||
'country' => 'United Arab Emirates',
|
'country' => 'United Arab Emirates',
|
||||||
'city' => 'Sharjah',
|
'city' => 'Sharjah',
|
||||||
'area' => 'Al Nahda',
|
'area' => 'Al Nahda',
|
||||||
@ -127,7 +127,7 @@ public function run(): void
|
|||||||
'name' => 'Grace Osei',
|
'name' => 'Grace Osei',
|
||||||
'email' => 'grace.osei@example.com',
|
'email' => 'grace.osei@example.com',
|
||||||
'phone' => '+971 50 222 3333',
|
'phone' => '+971 50 222 3333',
|
||||||
'nationality' => 'Ghana',
|
'nationality' => 'Ghanaian',
|
||||||
'country' => 'Saudi Arabia',
|
'country' => 'Saudi Arabia',
|
||||||
'city' => 'Riyadh',
|
'city' => 'Riyadh',
|
||||||
'area' => 'Al Olaya',
|
'area' => 'Al Olaya',
|
||||||
@ -149,7 +149,7 @@ public function run(): void
|
|||||||
'name' => 'Anoma Perera',
|
'name' => 'Anoma Perera',
|
||||||
'email' => 'anoma.perera@example.com',
|
'email' => 'anoma.perera@example.com',
|
||||||
'phone' => '+971 50 444 5555',
|
'phone' => '+971 50 444 5555',
|
||||||
'nationality' => 'Sri Lanka',
|
'nationality' => 'Sri Lankan',
|
||||||
'country' => 'Saudi Arabia',
|
'country' => 'Saudi Arabia',
|
||||||
'city' => 'Jeddah',
|
'city' => 'Jeddah',
|
||||||
'area' => 'Al Hamra',
|
'area' => 'Al Hamra',
|
||||||
@ -171,7 +171,7 @@ public function run(): void
|
|||||||
'name' => 'Ramesh Thapa',
|
'name' => 'Ramesh Thapa',
|
||||||
'email' => 'ramesh.thapa@example.com',
|
'email' => 'ramesh.thapa@example.com',
|
||||||
'phone' => '+971 50 666 7777',
|
'phone' => '+971 50 666 7777',
|
||||||
'nationality' => 'Nepal',
|
'nationality' => 'Nepalese',
|
||||||
'country' => 'Saudi Arabia',
|
'country' => 'Saudi Arabia',
|
||||||
'city' => 'Riyadh',
|
'city' => 'Riyadh',
|
||||||
'area' => 'Al Yasmin',
|
'area' => 'Al Yasmin',
|
||||||
|
|||||||
@ -1524,7 +1524,7 @@
|
|||||||
},
|
},
|
||||||
"nationality": {
|
"nationality": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "India"
|
"example": "Indian"
|
||||||
},
|
},
|
||||||
"language": {
|
"language": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -3321,7 +3321,7 @@
|
|||||||
"name": "nationality",
|
"name": "nationality",
|
||||||
"in": "query",
|
"in": "query",
|
||||||
"required": false,
|
"required": false,
|
||||||
"description": "Filter by nationality name (comma-separated list for multiple choice, e.g. India,Kenya,Ethiopia).",
|
"description": "Filter by nationality name (comma-separated list for multiple choice, e.g. Indian,Kenyan,Ethiopian).",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@ -3639,7 +3639,7 @@
|
|||||||
"name": "nationality",
|
"name": "nationality",
|
||||||
"in": "query",
|
"in": "query",
|
||||||
"required": false,
|
"required": false,
|
||||||
"description": "Filter candidates by nationality name (comma-separated list for multiple choice, e.g. India,Kenya,Ethiopia).",
|
"description": "Filter candidates by nationality name (comma-separated list for multiple choice, e.g. Indian,Kenyan,Ethiopian).",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,13 +40,13 @@ protected function setUp(): void
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Seed 3 workers with specific filter attributes
|
// Seed 3 workers with specific filter attributes
|
||||||
// Worker 1: Dubai, full-time, live-in, India, in_country=true, Residence Visa, female
|
// Worker 1: Dubai, full-time, live-in, Indian, in_country=true, Residence Visa, female
|
||||||
$w1 = Worker::create([
|
$w1 = Worker::create([
|
||||||
'name' => 'Worker India In Dubai',
|
'name' => 'Worker Indian In Dubai',
|
||||||
'email' => 'worker1@example.com',
|
'email' => 'worker1@example.com',
|
||||||
'phone' => '+971501111111',
|
'phone' => '+971501111111',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'nationality' => 'India',
|
'nationality' => 'Indian',
|
||||||
'category_id' => $this->category->id,
|
'category_id' => $this->category->id,
|
||||||
'verified' => true,
|
'verified' => true,
|
||||||
'status' => 'active',
|
'status' => 'active',
|
||||||
@ -72,13 +72,13 @@ protected function setUp(): void
|
|||||||
'file_path' => 'passports/test1.jpg',
|
'file_path' => 'passports/test1.jpg',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Worker 2: Abu Dhabi, part-time, live-out, Philippines, in_country=true, Tourist Visa, female
|
// Worker 2: Abu Dhabi, part-time, live-out, Filipino, in_country=true, Tourist Visa, female
|
||||||
$w2 = Worker::create([
|
$w2 = Worker::create([
|
||||||
'name' => 'Worker Philippines In Abu Dhabi',
|
'name' => 'Worker Filipino In Abu Dhabi',
|
||||||
'email' => 'worker2@example.com',
|
'email' => 'worker2@example.com',
|
||||||
'phone' => '+971502222222',
|
'phone' => '+971502222222',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'nationality' => 'Philippines',
|
'nationality' => 'Filipino',
|
||||||
'category_id' => $this->category->id,
|
'category_id' => $this->category->id,
|
||||||
'verified' => true,
|
'verified' => true,
|
||||||
'status' => 'active',
|
'status' => 'active',
|
||||||
@ -104,13 +104,13 @@ protected function setUp(): void
|
|||||||
'file_path' => 'passports/test2.jpg',
|
'file_path' => 'passports/test2.jpg',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Worker 3: Dubai, full-time, live-out, Kenya, in_country=false, Cancelled Visa, male
|
// Worker 3: Dubai, full-time, live-out, Kenyan, in_country=false, Cancelled Visa, male
|
||||||
$w3 = Worker::create([
|
$w3 = Worker::create([
|
||||||
'name' => 'Worker Kenya Out Country',
|
'name' => 'Worker Kenyan Out Country',
|
||||||
'email' => 'worker3@example.com',
|
'email' => 'worker3@example.com',
|
||||||
'phone' => '+971503333333',
|
'phone' => '+971503333333',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'nationality' => 'Kenya',
|
'nationality' => 'Kenyan',
|
||||||
'category_id' => $this->category->id,
|
'category_id' => $this->category->id,
|
||||||
'verified' => true,
|
'verified' => true,
|
||||||
'status' => 'active',
|
'status' => 'active',
|
||||||
@ -149,7 +149,7 @@ public function test_get_workers_preferred_location_filter()
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$workers = $response->json('data.workers');
|
$workers = $response->json('data.workers');
|
||||||
$this->assertCount(1, $workers);
|
$this->assertCount(1, $workers);
|
||||||
$this->assertEquals('Worker Philippines In Abu Dhabi', $workers[0]['name']);
|
$this->assertEquals('Worker Filipino In Abu Dhabi', $workers[0]['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_workers_job_type_filter()
|
public function test_get_workers_job_type_filter()
|
||||||
@ -161,7 +161,7 @@ public function test_get_workers_job_type_filter()
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$workers = $response->json('data.workers');
|
$workers = $response->json('data.workers');
|
||||||
$this->assertCount(1, $workers);
|
$this->assertCount(1, $workers);
|
||||||
$this->assertEquals('Worker Philippines In Abu Dhabi', $workers[0]['name']);
|
$this->assertEquals('Worker Filipino In Abu Dhabi', $workers[0]['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_workers_live_in_out_filter()
|
public function test_get_workers_live_in_out_filter()
|
||||||
@ -179,7 +179,7 @@ public function test_get_workers_nationality_multiple_filter()
|
|||||||
{
|
{
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'Authorization' => 'Bearer ' . $this->token,
|
'Authorization' => 'Bearer ' . $this->token,
|
||||||
])->getJson('/api/employers/workers?nationality=India,Kenya');
|
])->getJson('/api/employers/workers?nationality=Indian,Kenyan');
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$workers = $response->json('data.workers');
|
$workers = $response->json('data.workers');
|
||||||
@ -195,7 +195,7 @@ public function test_get_workers_in_country_filter()
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$workers = $response->json('data.workers');
|
$workers = $response->json('data.workers');
|
||||||
$this->assertCount(1, $workers);
|
$this->assertCount(1, $workers);
|
||||||
$this->assertEquals('Worker Kenya Out Country', $workers[0]['name']);
|
$this->assertEquals('Worker Kenyan Out Country', $workers[0]['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_workers_visa_status_if_in_country_filter()
|
public function test_get_workers_visa_status_if_in_country_filter()
|
||||||
@ -208,7 +208,7 @@ public function test_get_workers_visa_status_if_in_country_filter()
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$workers = $response->json('data.workers');
|
$workers = $response->json('data.workers');
|
||||||
$this->assertCount(1, $workers);
|
$this->assertCount(1, $workers);
|
||||||
$this->assertEquals('Worker Philippines In Abu Dhabi', $workers[0]['name']);
|
$this->assertEquals('Worker Filipino In Abu Dhabi', $workers[0]['name']);
|
||||||
|
|
||||||
// Cancelled Visa is for Worker 3, but Worker 3 is out country, so it should not match
|
// Cancelled Visa is for Worker 3, but Worker 3 is out country, so it should not match
|
||||||
// because of the "if in country next visa type" constraint.
|
// because of the "if in country next visa type" constraint.
|
||||||
@ -228,9 +228,9 @@ public function test_get_candidates_filters()
|
|||||||
{
|
{
|
||||||
// To be in getCandidates, candidates need status 'Hired' per current logic:
|
// To be in getCandidates, candidates need status 'Hired' per current logic:
|
||||||
// Let's create three direct offers with status accepted (which maps to 'Hired')
|
// Let's create three direct offers with status accepted (which maps to 'Hired')
|
||||||
$worker1 = Worker::where('nationality', 'India')->first();
|
$worker1 = Worker::where('nationality', 'Indian')->first();
|
||||||
$worker2 = Worker::where('nationality', 'Philippines')->first();
|
$worker2 = Worker::where('nationality', 'Filipino')->first();
|
||||||
$worker3 = Worker::where('nationality', 'Kenya')->first();
|
$worker3 = Worker::where('nationality', 'Kenyan')->first();
|
||||||
|
|
||||||
JobOffer::create([
|
JobOffer::create([
|
||||||
'employer_id' => $this->employer->id,
|
'employer_id' => $this->employer->id,
|
||||||
@ -279,7 +279,7 @@ public function test_get_candidates_filters()
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$candidates = $response->json('data.candidates');
|
$candidates = $response->json('data.candidates');
|
||||||
$this->assertCount(1, $candidates);
|
$this->assertCount(1, $candidates);
|
||||||
$this->assertEquals('Worker Philippines In Abu Dhabi', $candidates[0]['name']);
|
$this->assertEquals('Worker Filipino In Abu Dhabi', $candidates[0]['name']);
|
||||||
|
|
||||||
// Filter candidates by live_in_out
|
// Filter candidates by live_in_out
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
@ -289,17 +289,17 @@ public function test_get_candidates_filters()
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$candidates = $response->json('data.candidates');
|
$candidates = $response->json('data.candidates');
|
||||||
$this->assertCount(1, $candidates);
|
$this->assertCount(1, $candidates);
|
||||||
$this->assertEquals('Worker India In Dubai', $candidates[0]['name']);
|
$this->assertEquals('Worker Indian In Dubai', $candidates[0]['name']);
|
||||||
|
|
||||||
// Filter candidates by nationality
|
// Filter candidates by nationality
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'Authorization' => 'Bearer ' . $this->token,
|
'Authorization' => 'Bearer ' . $this->token,
|
||||||
])->getJson('/api/employers/candidates?nationality=Kenya');
|
])->getJson('/api/employers/candidates?nationality=Kenyan');
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$candidates = $response->json('data.candidates');
|
$candidates = $response->json('data.candidates');
|
||||||
$this->assertCount(1, $candidates);
|
$this->assertCount(1, $candidates);
|
||||||
$this->assertEquals('Worker Kenya Out Country', $candidates[0]['name']);
|
$this->assertEquals('Worker Kenyan Out Country', $candidates[0]['name']);
|
||||||
|
|
||||||
// Filter candidates by in_country
|
// Filter candidates by in_country
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
@ -309,7 +309,7 @@ public function test_get_candidates_filters()
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$candidates = $response->json('data.candidates');
|
$candidates = $response->json('data.candidates');
|
||||||
$this->assertCount(1, $candidates);
|
$this->assertCount(1, $candidates);
|
||||||
$this->assertEquals('Worker Kenya Out Country', $candidates[0]['name']);
|
$this->assertEquals('Worker Kenyan Out Country', $candidates[0]['name']);
|
||||||
|
|
||||||
// Filter candidates by visa_status (if in country)
|
// Filter candidates by visa_status (if in country)
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
@ -319,7 +319,7 @@ public function test_get_candidates_filters()
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$candidates = $response->json('data.candidates');
|
$candidates = $response->json('data.candidates');
|
||||||
$this->assertCount(1, $candidates);
|
$this->assertCount(1, $candidates);
|
||||||
$this->assertEquals('Worker Philippines In Abu Dhabi', $candidates[0]['name']);
|
$this->assertEquals('Worker Filipino In Abu Dhabi', $candidates[0]['name']);
|
||||||
|
|
||||||
// Filter candidates by gender
|
// Filter candidates by gender
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
@ -329,7 +329,7 @@ public function test_get_candidates_filters()
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$candidates = $response->json('data.candidates');
|
$candidates = $response->json('data.candidates');
|
||||||
$this->assertCount(1, $candidates);
|
$this->assertCount(1, $candidates);
|
||||||
$this->assertEquals('Worker Kenya Out Country', $candidates[0]['name']);
|
$this->assertEquals('Worker Kenyan Out Country', $candidates[0]['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_workers_gender_filter()
|
public function test_get_workers_gender_filter()
|
||||||
@ -341,7 +341,7 @@ public function test_get_workers_gender_filter()
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$workers = $response->json('data.workers');
|
$workers = $response->json('data.workers');
|
||||||
$this->assertCount(1, $workers);
|
$this->assertCount(1, $workers);
|
||||||
$this->assertEquals('Worker Kenya Out Country', $workers[0]['name']);
|
$this->assertEquals('Worker Kenyan Out Country', $workers[0]['name']);
|
||||||
|
|
||||||
$response2 = $this->withHeaders([
|
$response2 = $this->withHeaders([
|
||||||
'Authorization' => 'Bearer ' . $this->token,
|
'Authorization' => 'Bearer ' . $this->token,
|
||||||
@ -361,14 +361,14 @@ public function test_get_workers_area_filter()
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$workers = $response->json('data.workers');
|
$workers = $response->json('data.workers');
|
||||||
$this->assertCount(1, $workers);
|
$this->assertCount(1, $workers);
|
||||||
$this->assertEquals('Worker Kenya Out Country', $workers[0]['name']);
|
$this->assertEquals('Worker Kenyan Out Country', $workers[0]['name']);
|
||||||
$this->assertEquals('Marina', $workers[0]['area']);
|
$this->assertEquals('Marina', $workers[0]['area']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_candidates_area_filter()
|
public function test_get_candidates_area_filter()
|
||||||
{
|
{
|
||||||
$worker1 = Worker::where('nationality', 'India')->first();
|
$worker1 = Worker::where('nationality', 'Indian')->first();
|
||||||
$worker2 = Worker::where('nationality', 'Philippines')->first();
|
$worker2 = Worker::where('nationality', 'Filipino')->first();
|
||||||
|
|
||||||
JobOffer::create([
|
JobOffer::create([
|
||||||
'employer_id' => $this->employer->id,
|
'employer_id' => $this->employer->id,
|
||||||
@ -397,7 +397,7 @@ public function test_get_candidates_area_filter()
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$candidates = $response->json('data.candidates');
|
$candidates = $response->json('data.candidates');
|
||||||
$this->assertCount(1, $candidates);
|
$this->assertCount(1, $candidates);
|
||||||
$this->assertEquals('Worker India In Dubai', $candidates[0]['name']);
|
$this->assertEquals('Worker Indian In Dubai', $candidates[0]['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_worker_list_includes_document_expiry_status()
|
public function test_worker_list_includes_document_expiry_status()
|
||||||
@ -407,7 +407,7 @@ public function test_worker_list_includes_document_expiry_status()
|
|||||||
'email' => 'worker_expiry@example.com',
|
'email' => 'worker_expiry@example.com',
|
||||||
'phone' => '+971509999999',
|
'phone' => '+971509999999',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'nationality' => 'Kenya',
|
'nationality' => 'Kenyan',
|
||||||
'category_id' => $this->category->id,
|
'category_id' => $this->category->id,
|
||||||
'verified' => true,
|
'verified' => true,
|
||||||
'status' => 'active',
|
'status' => 'active',
|
||||||
|
|||||||
@ -34,11 +34,11 @@ protected function setUp(): void
|
|||||||
|
|
||||||
// Seed some workers
|
// Seed some workers
|
||||||
$w1 = Worker::create([
|
$w1 = Worker::create([
|
||||||
'name' => 'Worker India Dubai',
|
'name' => 'Worker Indian Dubai',
|
||||||
'email' => 'worker1@example.com',
|
'email' => 'worker1@example.com',
|
||||||
'phone' => '+971501111111',
|
'phone' => '+971501111111',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'nationality' => 'India',
|
'nationality' => 'Indian',
|
||||||
'category_id' => $this->category->id,
|
'category_id' => $this->category->id,
|
||||||
'verified' => true,
|
'verified' => true,
|
||||||
'status' => 'active',
|
'status' => 'active',
|
||||||
@ -64,11 +64,11 @@ protected function setUp(): void
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$w2 = Worker::create([
|
$w2 = Worker::create([
|
||||||
'name' => 'Worker Philippines Abu Dhabi',
|
'name' => 'Worker Filipino Abu Dhabi',
|
||||||
'email' => 'worker2@example.com',
|
'email' => 'worker2@example.com',
|
||||||
'phone' => '+971502222222',
|
'phone' => '+971502222222',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'nationality' => 'Philippines',
|
'nationality' => 'Filipino',
|
||||||
'category_id' => $this->category->id,
|
'category_id' => $this->category->id,
|
||||||
'verified' => true,
|
'verified' => true,
|
||||||
'status' => 'active',
|
'status' => 'active',
|
||||||
@ -117,40 +117,40 @@ public function test_employer_workers_web_filtering()
|
|||||||
->withSession(['user' => $this->employer])
|
->withSession(['user' => $this->employer])
|
||||||
->get(route('employer.workers', ['preferred_location' => 'Abu Dhabi']));
|
->get(route('employer.workers', ['preferred_location' => 'Abu Dhabi']));
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertSee('Worker Philippines Abu Dhabi');
|
$response->assertSee('Worker Filipino Abu Dhabi');
|
||||||
$response->assertDontSee('Worker India Dubai');
|
$response->assertDontSee('Worker Indian Dubai');
|
||||||
|
|
||||||
// 2. Filter by nationality
|
// 2. Filter by nationality
|
||||||
$response = $this->actingAs($this->employer)
|
$response = $this->actingAs($this->employer)
|
||||||
->withSession(['user' => $this->employer])
|
->withSession(['user' => $this->employer])
|
||||||
->get(route('employer.workers', ['nationality' => 'India']));
|
->get(route('employer.workers', ['nationality' => 'Indian']));
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertSee('Worker India Dubai');
|
$response->assertSee('Worker Indian Dubai');
|
||||||
$response->assertDontSee('Worker Philippines Abu Dhabi');
|
$response->assertDontSee('Worker Filipino Abu Dhabi');
|
||||||
|
|
||||||
// 3. Filter by job_type
|
// 3. Filter by job_type
|
||||||
$response = $this->actingAs($this->employer)
|
$response = $this->actingAs($this->employer)
|
||||||
->withSession(['user' => $this->employer])
|
->withSession(['user' => $this->employer])
|
||||||
->get(route('employer.workers', ['job_type' => 'part-time']));
|
->get(route('employer.workers', ['job_type' => 'part-time']));
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertSee('Worker Philippines Abu Dhabi');
|
$response->assertSee('Worker Filipino Abu Dhabi');
|
||||||
$response->assertDontSee('Worker India Dubai');
|
$response->assertDontSee('Worker Indian Dubai');
|
||||||
|
|
||||||
// 4. Filter by live_in_out
|
// 4. Filter by live_in_out
|
||||||
$response = $this->actingAs($this->employer)
|
$response = $this->actingAs($this->employer)
|
||||||
->withSession(['user' => $this->employer])
|
->withSession(['user' => $this->employer])
|
||||||
->get(route('employer.workers', ['live_in_out' => 'live_in']));
|
->get(route('employer.workers', ['live_in_out' => 'live_in']));
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertSee('Worker India Dubai');
|
$response->assertSee('Worker Indian Dubai');
|
||||||
$response->assertDontSee('Worker Philippines Abu Dhabi');
|
$response->assertDontSee('Worker Filipino Abu Dhabi');
|
||||||
|
|
||||||
// 5. Filter by visa_status
|
// 5. Filter by visa_status
|
||||||
$response = $this->actingAs($this->employer)
|
$response = $this->actingAs($this->employer)
|
||||||
->withSession(['user' => $this->employer])
|
->withSession(['user' => $this->employer])
|
||||||
->get(route('employer.workers', ['visa_status' => 'Tourist Visa']));
|
->get(route('employer.workers', ['visa_status' => 'Tourist Visa']));
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertSee('Worker Philippines Abu Dhabi');
|
$response->assertSee('Worker Filipino Abu Dhabi');
|
||||||
$response->assertDontSee('Worker India Dubai');
|
$response->assertDontSee('Worker Indian Dubai');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,11 +160,11 @@ public function test_employer_can_view_candidates_index_and_apply_filters()
|
|||||||
{
|
{
|
||||||
// Add a hired worker (candidate)
|
// Add a hired worker (candidate)
|
||||||
$w = Worker::create([
|
$w = Worker::create([
|
||||||
'name' => 'Worker Kenya Hired',
|
'name' => 'Worker Kenyan Hired',
|
||||||
'email' => 'worker3@example.com',
|
'email' => 'worker3@example.com',
|
||||||
'phone' => '+971503333333',
|
'phone' => '+971503333333',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'nationality' => 'Kenya',
|
'nationality' => 'Kenyan',
|
||||||
'category_id' => $this->category->id,
|
'category_id' => $this->category->id,
|
||||||
'verified' => true,
|
'verified' => true,
|
||||||
'status' => 'Hired',
|
'status' => 'Hired',
|
||||||
@ -215,11 +215,11 @@ public function test_employer_workers_web_multiple_nationality_filtering()
|
|||||||
{
|
{
|
||||||
$response = $this->actingAs($this->employer)
|
$response = $this->actingAs($this->employer)
|
||||||
->withSession(['user' => $this->employer])
|
->withSession(['user' => $this->employer])
|
||||||
->get(route('employer.workers', ['nationality' => 'India,Philippines']));
|
->get(route('employer.workers', ['nationality' => 'Indian,Filipino']));
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertSee('Worker India Dubai');
|
$response->assertSee('Worker Indian Dubai');
|
||||||
$response->assertSee('Worker Philippines Abu Dhabi');
|
$response->assertSee('Worker Filipino Abu Dhabi');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -232,7 +232,7 @@ public function test_employer_workers_web_gender_filtering()
|
|||||||
->get(route('employer.workers', ['gender' => 'female']));
|
->get(route('employer.workers', ['gender' => 'female']));
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
$response->assertSee('Worker India Dubai');
|
$response->assertSee('Worker Indian Dubai');
|
||||||
$response->assertDontSee('Worker Philippines Abu Dhabi');
|
$response->assertDontSee('Worker Filipino Abu Dhabi');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,7 +128,7 @@ public function test_s1_complete_basic_profile_setup()
|
|||||||
$response = $this->postJson('/api/workers/setup-profile', [
|
$response = $this->postJson('/api/workers/setup-profile', [
|
||||||
'phone' => $phone,
|
'phone' => $phone,
|
||||||
'name' => 'Rahul Sharma',
|
'name' => 'Rahul Sharma',
|
||||||
'nationality' => 'India',
|
'nationality' => 'Indian',
|
||||||
'language' => 'HI',
|
'language' => 'HI',
|
||||||
'gender' => 'male',
|
'gender' => 'male',
|
||||||
'skills' => [],
|
'skills' => [],
|
||||||
@ -176,7 +176,7 @@ public function test_s2_update_experience_and_preferences()
|
|||||||
'phone' => '+971509999999',
|
'phone' => '+971509999999',
|
||||||
'language' => 'SW',
|
'language' => 'SW',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'nationality' => 'Kenya',
|
'nationality' => 'Kenyan',
|
||||||
'age' => 22,
|
'age' => 22,
|
||||||
'salary' => 1200,
|
'salary' => 1200,
|
||||||
'availability' => 'Immediate',
|
'availability' => 'Immediate',
|
||||||
@ -220,7 +220,7 @@ public function test_s3_go_live()
|
|||||||
'phone' => '+971508888888',
|
'phone' => '+971508888888',
|
||||||
'language' => 'TA',
|
'language' => 'TA',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'nationality' => 'Sri Lanka',
|
'nationality' => 'Sri Lankan',
|
||||||
'age' => 32,
|
'age' => 32,
|
||||||
'salary' => 1400,
|
'salary' => 1400,
|
||||||
'availability' => 'Not Available',
|
'availability' => 'Not Available',
|
||||||
@ -259,7 +259,7 @@ public function test_s5_toggle_availability_still_looking()
|
|||||||
'phone' => '+971501234567',
|
'phone' => '+971501234567',
|
||||||
'language' => 'HI',
|
'language' => 'HI',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'nationality' => 'India',
|
'nationality' => 'Indian',
|
||||||
'age' => 25,
|
'age' => 25,
|
||||||
'salary' => 1500,
|
'salary' => 1500,
|
||||||
'availability' => 'Immediate',
|
'availability' => 'Immediate',
|
||||||
@ -322,7 +322,7 @@ public function test_s6_outcome_mark_hired()
|
|||||||
'phone' => '+971501234567',
|
'phone' => '+971501234567',
|
||||||
'language' => 'HI',
|
'language' => 'HI',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'nationality' => 'India',
|
'nationality' => 'Indian',
|
||||||
'age' => 25,
|
'age' => 25,
|
||||||
'salary' => 1500,
|
'salary' => 1500,
|
||||||
'availability' => 'Immediate',
|
'availability' => 'Immediate',
|
||||||
@ -362,7 +362,7 @@ public function test_register_with_new_api_fields()
|
|||||||
'password' => 'secret123',
|
'password' => 'secret123',
|
||||||
'passport_file' => $fakePassport,
|
'passport_file' => $fakePassport,
|
||||||
'language' => 'HI',
|
'language' => 'HI',
|
||||||
'nationality' => 'Kenya',
|
'nationality' => 'Kenyan',
|
||||||
'age' => 30,
|
'age' => 30,
|
||||||
'experience' => '5 Years',
|
'experience' => '5 Years',
|
||||||
'in_country' => 'true',
|
'in_country' => 'true',
|
||||||
@ -398,7 +398,7 @@ public function test_update_profile_with_new_api_fields()
|
|||||||
'phone' => '+971502222223',
|
'phone' => '+971502222223',
|
||||||
'language' => 'SW',
|
'language' => 'SW',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'nationality' => 'Kenya',
|
'nationality' => 'Kenyan',
|
||||||
'age' => 22,
|
'age' => 22,
|
||||||
'salary' => 1200,
|
'salary' => 1200,
|
||||||
'availability' => 'Immediate',
|
'availability' => 'Immediate',
|
||||||
@ -623,7 +623,7 @@ public function test_worker_dashboard_stats()
|
|||||||
'phone' => '+971501234567',
|
'phone' => '+971501234567',
|
||||||
'language' => 'HI',
|
'language' => 'HI',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'nationality' => 'India',
|
'nationality' => 'Indian',
|
||||||
'age' => 25,
|
'age' => 25,
|
||||||
'salary' => 1500,
|
'salary' => 1500,
|
||||||
'availability' => 'Immediate',
|
'availability' => 'Immediate',
|
||||||
@ -715,7 +715,7 @@ public function test_worker_new_announcements_flow()
|
|||||||
'phone' => '+971501234567',
|
'phone' => '+971501234567',
|
||||||
'language' => 'HI',
|
'language' => 'HI',
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
'nationality' => 'India',
|
'nationality' => 'Indian',
|
||||||
'age' => 25,
|
'age' => 25,
|
||||||
'salary' => 1500,
|
'salary' => 1500,
|
||||||
'availability' => 'Immediate',
|
'availability' => 'Immediate',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user