create('emirates_id.pdf', 500, 'application/pdf'); // Step 1: Registration Form Submission $responseStep1 = $this->post('/employer/register', [ 'name' => 'Abdullah Ahmed', 'email' => 'abdullah@example.com', 'phone' => '501234567', ]); $responseStep1->assertRedirect(route('employer.verify-email')); // Verify session data $pendingReg = session('pending_employer_registration'); $this->assertNotNull($pendingReg); $this->assertEquals('Abdullah Ahmed', $pendingReg['name']); // Step 2: OTP Verification (using local environment dummy code) $responseStep2 = $this->post('/employer/verify-email', [ 'otp' => '000000', ]); $responseStep2->assertRedirect(route('employer.upload-emirates-id')); $this->assertTrue(session('employer_email_verified')); // Step 3: Emirates ID Upload $responseStep3 = $this->post('/employer/upload-emirates-id', [ 'emirates_id_file' => $emiratesIdFile, ]); $responseStep3->assertRedirect(route('employer.register-payment')); $this->assertTrue(session('employer_emirates_id_uploaded')); $pendingRegAfterId = session('pending_employer_registration'); $this->assertNotNull($pendingRegAfterId['emirates_id_number']); $this->assertNotNull($pendingRegAfterId['emirates_id_expiry']); $this->assertNull($pendingRegAfterId['emirates_id_file']); // Step 4: Payment Choice $responseStep4 = $this->post('/employer/register-payment', [ 'plan_id' => 'premium', 'amount_aed' => 199.00, 'paytabs_transaction_id' => 'TRAN_ABC_123', ]); $responseStep4->assertJson(['message' => 'Payment processed successfully.']); // Step 5: Create Password & Create Records $responseStep5 = $this->post('/employer/create-password', [ 'password' => 'SecurePass123!', 'password_confirmation' => 'SecurePass123!', ]); $responseStep5->assertRedirect(route('employer.dashboard')); // Verify Database Records $this->assertDatabaseHas('users', [ 'email' => 'abdullah@example.com', 'role' => 'employer', ]); $this->assertDatabaseHas('employer_profiles', [ 'phone' => '501234567', 'company_name' => 'Abdullah Ahmed Household', 'emirates_id_front' => null, // File is not stored ]); $profile = EmployerProfile::where('phone', '501234567')->first(); $this->assertNotNull($profile->emirates_id_number); $this->assertNotNull($profile->emirates_id_expiry); $this->assertDatabaseHas('sponsors', [ 'email' => 'abdullah@example.com', 'mobile' => '501234567', 'emirates_id_file' => null, // File is not stored ]); } }