mohan #5

Merged
mohanmd merged 46 commits from mohan into master 2026-06-15 09:13:23 +00:00
6 changed files with 73 additions and 73 deletions
Showing only changes of commit 4ba8fac200 - Show all commits

View File

@ -208,7 +208,7 @@ public function index(Request $request)
[
'id' => 2,
'name' => 'Housekeeper (Indian, 1500-2000 AED)',
'query' => 'category=Housekeeping&nationality=India&max_salary=2000'
'query' => 'category=Housekeeping&nationality=Indian&max_salary=2000'
]
];

View File

@ -17,7 +17,7 @@ public function run(): void
'name' => 'John Doe',
'email' => 'john.doe@example.com',
'phone' => '+971 50 111 2222',
'nationality' => 'India',
'nationality' => 'Indian',
'country' => 'United Arab Emirates',
'city' => 'Dubai',
'area' => 'Dubai Marina',
@ -39,7 +39,7 @@ public function run(): void
'name' => 'Ali Hassan',
'email' => 'ali.hassan@example.com',
'phone' => '+971 50 333 4444',
'nationality' => 'Pakistan',
'nationality' => 'Pakistani',
'country' => 'United Arab Emirates',
'city' => 'Dubai',
'area' => 'Al Barsha',
@ -61,7 +61,7 @@ public function run(): void
'name' => 'Maria Santos',
'email' => 'maria.santos@example.com',
'phone' => '+971 50 555 6666',
'nationality' => 'Philippines',
'nationality' => 'Filipino',
'country' => 'United Arab Emirates',
'city' => 'Abu Dhabi',
'area' => 'Yas Island',
@ -83,7 +83,7 @@ public function run(): void
'name' => 'Lakshmi Sharma',
'email' => 'lakshmi.sharma@example.com',
'phone' => '+971 50 777 8888',
'nationality' => 'India',
'nationality' => 'Indian',
'country' => 'United Arab Emirates',
'city' => 'Abu Dhabi',
'area' => 'Khalifa City',
@ -105,7 +105,7 @@ public function run(): void
'name' => 'Siti Aminah',
'email' => 'siti.aminah@example.com',
'phone' => '+971 50 999 0000',
'nationality' => 'Indonesia',
'nationality' => 'Indonesian',
'country' => 'United Arab Emirates',
'city' => 'Sharjah',
'area' => 'Al Nahda',
@ -127,7 +127,7 @@ public function run(): void
'name' => 'Grace Osei',
'email' => 'grace.osei@example.com',
'phone' => '+971 50 222 3333',
'nationality' => 'Ghana',
'nationality' => 'Ghanaian',
'country' => 'Saudi Arabia',
'city' => 'Riyadh',
'area' => 'Al Olaya',
@ -149,7 +149,7 @@ public function run(): void
'name' => 'Anoma Perera',
'email' => 'anoma.perera@example.com',
'phone' => '+971 50 444 5555',
'nationality' => 'Sri Lanka',
'nationality' => 'Sri Lankan',
'country' => 'Saudi Arabia',
'city' => 'Jeddah',
'area' => 'Al Hamra',
@ -171,7 +171,7 @@ public function run(): void
'name' => 'Ramesh Thapa',
'email' => 'ramesh.thapa@example.com',
'phone' => '+971 50 666 7777',
'nationality' => 'Nepal',
'nationality' => 'Nepalese',
'country' => 'Saudi Arabia',
'city' => 'Riyadh',
'area' => 'Al Yasmin',

View File

@ -1524,7 +1524,7 @@
},
"nationality": {
"type": "string",
"example": "India"
"example": "Indian"
},
"language": {
"type": "string",
@ -3321,7 +3321,7 @@
"name": "nationality",
"in": "query",
"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": {
"type": "string"
}
@ -3639,7 +3639,7 @@
"name": "nationality",
"in": "query",
"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": {
"type": "string"
}

View File

@ -40,13 +40,13 @@ protected function setUp(): void
]);
// 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([
'name' => 'Worker India In Dubai',
'name' => 'Worker Indian In Dubai',
'email' => 'worker1@example.com',
'phone' => '+971501111111',
'password' => bcrypt('password'),
'nationality' => 'India',
'nationality' => 'Indian',
'category_id' => $this->category->id,
'verified' => true,
'status' => 'active',
@ -72,13 +72,13 @@ protected function setUp(): void
'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([
'name' => 'Worker Philippines In Abu Dhabi',
'name' => 'Worker Filipino In Abu Dhabi',
'email' => 'worker2@example.com',
'phone' => '+971502222222',
'password' => bcrypt('password'),
'nationality' => 'Philippines',
'nationality' => 'Filipino',
'category_id' => $this->category->id,
'verified' => true,
'status' => 'active',
@ -104,13 +104,13 @@ protected function setUp(): void
'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([
'name' => 'Worker Kenya Out Country',
'name' => 'Worker Kenyan Out Country',
'email' => 'worker3@example.com',
'phone' => '+971503333333',
'password' => bcrypt('password'),
'nationality' => 'Kenya',
'nationality' => 'Kenyan',
'category_id' => $this->category->id,
'verified' => true,
'status' => 'active',
@ -149,7 +149,7 @@ public function test_get_workers_preferred_location_filter()
$response->assertStatus(200);
$workers = $response->json('data.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()
@ -161,7 +161,7 @@ public function test_get_workers_job_type_filter()
$response->assertStatus(200);
$workers = $response->json('data.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()
@ -179,7 +179,7 @@ public function test_get_workers_nationality_multiple_filter()
{
$response = $this->withHeaders([
'Authorization' => 'Bearer ' . $this->token,
])->getJson('/api/employers/workers?nationality=India,Kenya');
])->getJson('/api/employers/workers?nationality=Indian,Kenyan');
$response->assertStatus(200);
$workers = $response->json('data.workers');
@ -195,7 +195,7 @@ public function test_get_workers_in_country_filter()
$response->assertStatus(200);
$workers = $response->json('data.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()
@ -208,7 +208,7 @@ public function test_get_workers_visa_status_if_in_country_filter()
$response->assertStatus(200);
$workers = $response->json('data.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
// 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:
// Let's create three direct offers with status accepted (which maps to 'Hired')
$worker1 = Worker::where('nationality', 'India')->first();
$worker2 = Worker::where('nationality', 'Philippines')->first();
$worker3 = Worker::where('nationality', 'Kenya')->first();
$worker1 = Worker::where('nationality', 'Indian')->first();
$worker2 = Worker::where('nationality', 'Filipino')->first();
$worker3 = Worker::where('nationality', 'Kenyan')->first();
JobOffer::create([
'employer_id' => $this->employer->id,
@ -279,7 +279,7 @@ public function test_get_candidates_filters()
$response->assertStatus(200);
$candidates = $response->json('data.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
$response = $this->withHeaders([
@ -289,17 +289,17 @@ public function test_get_candidates_filters()
$response->assertStatus(200);
$candidates = $response->json('data.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
$response = $this->withHeaders([
'Authorization' => 'Bearer ' . $this->token,
])->getJson('/api/employers/candidates?nationality=Kenya');
])->getJson('/api/employers/candidates?nationality=Kenyan');
$response->assertStatus(200);
$candidates = $response->json('data.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
$response = $this->withHeaders([
@ -309,7 +309,7 @@ public function test_get_candidates_filters()
$response->assertStatus(200);
$candidates = $response->json('data.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)
$response = $this->withHeaders([
@ -319,7 +319,7 @@ public function test_get_candidates_filters()
$response->assertStatus(200);
$candidates = $response->json('data.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
$response = $this->withHeaders([
@ -329,7 +329,7 @@ public function test_get_candidates_filters()
$response->assertStatus(200);
$candidates = $response->json('data.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()
@ -341,7 +341,7 @@ public function test_get_workers_gender_filter()
$response->assertStatus(200);
$workers = $response->json('data.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([
'Authorization' => 'Bearer ' . $this->token,
@ -361,14 +361,14 @@ public function test_get_workers_area_filter()
$response->assertStatus(200);
$workers = $response->json('data.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']);
}
public function test_get_candidates_area_filter()
{
$worker1 = Worker::where('nationality', 'India')->first();
$worker2 = Worker::where('nationality', 'Philippines')->first();
$worker1 = Worker::where('nationality', 'Indian')->first();
$worker2 = Worker::where('nationality', 'Filipino')->first();
JobOffer::create([
'employer_id' => $this->employer->id,
@ -397,7 +397,7 @@ public function test_get_candidates_area_filter()
$response->assertStatus(200);
$candidates = $response->json('data.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()
@ -407,7 +407,7 @@ public function test_worker_list_includes_document_expiry_status()
'email' => 'worker_expiry@example.com',
'phone' => '+971509999999',
'password' => bcrypt('password'),
'nationality' => 'Kenya',
'nationality' => 'Kenyan',
'category_id' => $this->category->id,
'verified' => true,
'status' => 'active',

View File

@ -34,11 +34,11 @@ protected function setUp(): void
// Seed some workers
$w1 = Worker::create([
'name' => 'Worker India Dubai',
'name' => 'Worker Indian Dubai',
'email' => 'worker1@example.com',
'phone' => '+971501111111',
'password' => bcrypt('password'),
'nationality' => 'India',
'nationality' => 'Indian',
'category_id' => $this->category->id,
'verified' => true,
'status' => 'active',
@ -64,11 +64,11 @@ protected function setUp(): void
]);
$w2 = Worker::create([
'name' => 'Worker Philippines Abu Dhabi',
'name' => 'Worker Filipino Abu Dhabi',
'email' => 'worker2@example.com',
'phone' => '+971502222222',
'password' => bcrypt('password'),
'nationality' => 'Philippines',
'nationality' => 'Filipino',
'category_id' => $this->category->id,
'verified' => true,
'status' => 'active',
@ -117,40 +117,40 @@ public function test_employer_workers_web_filtering()
->withSession(['user' => $this->employer])
->get(route('employer.workers', ['preferred_location' => 'Abu Dhabi']));
$response->assertStatus(200);
$response->assertSee('Worker Philippines Abu Dhabi');
$response->assertDontSee('Worker India Dubai');
$response->assertSee('Worker Filipino Abu Dhabi');
$response->assertDontSee('Worker Indian Dubai');
// 2. Filter by nationality
$response = $this->actingAs($this->employer)
->withSession(['user' => $this->employer])
->get(route('employer.workers', ['nationality' => 'India']));
->get(route('employer.workers', ['nationality' => 'Indian']));
$response->assertStatus(200);
$response->assertSee('Worker India Dubai');
$response->assertDontSee('Worker Philippines Abu Dhabi');
$response->assertSee('Worker Indian Dubai');
$response->assertDontSee('Worker Filipino Abu Dhabi');
// 3. Filter by job_type
$response = $this->actingAs($this->employer)
->withSession(['user' => $this->employer])
->get(route('employer.workers', ['job_type' => 'part-time']));
$response->assertStatus(200);
$response->assertSee('Worker Philippines Abu Dhabi');
$response->assertDontSee('Worker India Dubai');
$response->assertSee('Worker Filipino Abu Dhabi');
$response->assertDontSee('Worker Indian Dubai');
// 4. Filter by live_in_out
$response = $this->actingAs($this->employer)
->withSession(['user' => $this->employer])
->get(route('employer.workers', ['live_in_out' => 'live_in']));
$response->assertStatus(200);
$response->assertSee('Worker India Dubai');
$response->assertDontSee('Worker Philippines Abu Dhabi');
$response->assertSee('Worker Indian Dubai');
$response->assertDontSee('Worker Filipino Abu Dhabi');
// 5. Filter by visa_status
$response = $this->actingAs($this->employer)
->withSession(['user' => $this->employer])
->get(route('employer.workers', ['visa_status' => 'Tourist Visa']));
$response->assertStatus(200);
$response->assertSee('Worker Philippines Abu Dhabi');
$response->assertDontSee('Worker India Dubai');
$response->assertSee('Worker Filipino Abu Dhabi');
$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)
$w = Worker::create([
'name' => 'Worker Kenya Hired',
'name' => 'Worker Kenyan Hired',
'email' => 'worker3@example.com',
'phone' => '+971503333333',
'password' => bcrypt('password'),
'nationality' => 'Kenya',
'nationality' => 'Kenyan',
'category_id' => $this->category->id,
'verified' => true,
'status' => 'Hired',
@ -215,11 +215,11 @@ public function test_employer_workers_web_multiple_nationality_filtering()
{
$response = $this->actingAs($this->employer)
->withSession(['user' => $this->employer])
->get(route('employer.workers', ['nationality' => 'India,Philippines']));
->get(route('employer.workers', ['nationality' => 'Indian,Filipino']));
$response->assertStatus(200);
$response->assertSee('Worker India Dubai');
$response->assertSee('Worker Philippines Abu Dhabi');
$response->assertSee('Worker Indian Dubai');
$response->assertSee('Worker Filipino Abu Dhabi');
}
/**
@ -232,7 +232,7 @@ public function test_employer_workers_web_gender_filtering()
->get(route('employer.workers', ['gender' => 'female']));
$response->assertStatus(200);
$response->assertSee('Worker India Dubai');
$response->assertDontSee('Worker Philippines Abu Dhabi');
$response->assertSee('Worker Indian Dubai');
$response->assertDontSee('Worker Filipino Abu Dhabi');
}
}

View File

@ -128,7 +128,7 @@ public function test_s1_complete_basic_profile_setup()
$response = $this->postJson('/api/workers/setup-profile', [
'phone' => $phone,
'name' => 'Rahul Sharma',
'nationality' => 'India',
'nationality' => 'Indian',
'language' => 'HI',
'gender' => 'male',
'skills' => [],
@ -176,7 +176,7 @@ public function test_s2_update_experience_and_preferences()
'phone' => '+971509999999',
'language' => 'SW',
'password' => bcrypt('password'),
'nationality' => 'Kenya',
'nationality' => 'Kenyan',
'age' => 22,
'salary' => 1200,
'availability' => 'Immediate',
@ -220,7 +220,7 @@ public function test_s3_go_live()
'phone' => '+971508888888',
'language' => 'TA',
'password' => bcrypt('password'),
'nationality' => 'Sri Lanka',
'nationality' => 'Sri Lankan',
'age' => 32,
'salary' => 1400,
'availability' => 'Not Available',
@ -259,7 +259,7 @@ public function test_s5_toggle_availability_still_looking()
'phone' => '+971501234567',
'language' => 'HI',
'password' => bcrypt('password'),
'nationality' => 'India',
'nationality' => 'Indian',
'age' => 25,
'salary' => 1500,
'availability' => 'Immediate',
@ -322,7 +322,7 @@ public function test_s6_outcome_mark_hired()
'phone' => '+971501234567',
'language' => 'HI',
'password' => bcrypt('password'),
'nationality' => 'India',
'nationality' => 'Indian',
'age' => 25,
'salary' => 1500,
'availability' => 'Immediate',
@ -362,7 +362,7 @@ public function test_register_with_new_api_fields()
'password' => 'secret123',
'passport_file' => $fakePassport,
'language' => 'HI',
'nationality' => 'Kenya',
'nationality' => 'Kenyan',
'age' => 30,
'experience' => '5 Years',
'in_country' => 'true',
@ -398,7 +398,7 @@ public function test_update_profile_with_new_api_fields()
'phone' => '+971502222223',
'language' => 'SW',
'password' => bcrypt('password'),
'nationality' => 'Kenya',
'nationality' => 'Kenyan',
'age' => 22,
'salary' => 1200,
'availability' => 'Immediate',
@ -623,7 +623,7 @@ public function test_worker_dashboard_stats()
'phone' => '+971501234567',
'language' => 'HI',
'password' => bcrypt('password'),
'nationality' => 'India',
'nationality' => 'Indian',
'age' => 25,
'salary' => 1500,
'availability' => 'Immediate',
@ -715,7 +715,7 @@ public function test_worker_new_announcements_flow()
'phone' => '+971501234567',
'language' => 'HI',
'password' => bcrypt('password'),
'nationality' => 'India',
'nationality' => 'Indian',
'age' => 25,
'salary' => 1500,
'availability' => 'Immediate',