fix(tests): 同步 Feature test 與 provider-verification-workflow 架構變更
Run Tests / test (pull_request) Failing after 2s
Run Tests / test (pull_request) Failing after 2s
provider-verification-workflow (#36) 在 feature-test-coverage (#38) merge 前 已將 is_verified 欄位替換為 verification_status 狀態機,並移除 toggle-verified 路由。 - 五個 Feature test 的 makeProvider helper 改用 verification_status='approved' (原 is_verified 已從 provider_profiles 欄位移除,靜默忽略導致 422/404) - AdminUserManagementTest: toggle-verified 案例改為測試新的 approve 端點 (PUT /admin/verifications/{userId}/approve,需 pending 狀態才可核准) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -31,10 +31,10 @@ class AdminUserManagementTest extends TestCase
|
||||
return $member;
|
||||
}
|
||||
|
||||
private function makeProvider(bool $isVerified = false): User
|
||||
private function makeProvider(string $verificationStatus = 'unsubmitted'): User
|
||||
{
|
||||
$provider = User::factory()->create(['role' => 'provider']);
|
||||
ProviderProfile::create(['user_id' => $provider->id, 'is_verified' => $isVerified]);
|
||||
ProviderProfile::create(['user_id' => $provider->id, 'verification_status' => $verificationStatus]);
|
||||
return $provider;
|
||||
}
|
||||
|
||||
@@ -89,21 +89,21 @@ class AdminUserManagementTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
// ── toggle-verified ──────────────────────────────────────
|
||||
// ── approve ─────────────────────────────────────────────
|
||||
|
||||
public function test_admin_toggles_provider_verified_status(): void
|
||||
public function test_admin_approves_provider_verification(): void
|
||||
{
|
||||
$admin = $this->makeAdmin();
|
||||
$provider = $this->makeProvider(isVerified: false);
|
||||
$provider = $this->makeProvider(verificationStatus: 'pending');
|
||||
|
||||
$this->actingAs($admin)
|
||||
->putJson("/api/admin/providers/{$provider->id}/toggle-verified")
|
||||
->putJson("/api/admin/verifications/{$provider->id}/approve")
|
||||
->assertOk()
|
||||
->assertJsonPath('data.is_verified', true);
|
||||
->assertJsonPath('status', true);
|
||||
|
||||
$this->assertDatabaseHas('provider_profiles', [
|
||||
'user_id' => $provider->id,
|
||||
'is_verified' => true,
|
||||
'verification_status' => 'approved',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class BookingListTest extends TestCase
|
||||
private function makeProviderWithSchedule(): array
|
||||
{
|
||||
$provider = User::factory()->create(['role' => 'provider']);
|
||||
ProviderProfile::create(['user_id' => $provider->id, 'is_verified' => true]);
|
||||
ProviderProfile::create(['user_id' => $provider->id, 'verification_status' => 'approved']);
|
||||
|
||||
$offer = DivingOffer::create([
|
||||
'provider_id' => $provider->id,
|
||||
|
||||
@@ -43,7 +43,7 @@ class NotificationTriggerTest extends TestCase
|
||||
private function makeProvider(): User
|
||||
{
|
||||
$provider = User::factory()->create(['role' => 'provider']);
|
||||
ProviderProfile::create(['user_id' => $provider->id, 'is_verified' => true]);
|
||||
ProviderProfile::create(['user_id' => $provider->id, 'verification_status' => 'approved']);
|
||||
return $provider;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class ProviderOfferCrudTest extends TestCase
|
||||
private function makeProvider(): User
|
||||
{
|
||||
$provider = User::factory()->create(['role' => 'provider']);
|
||||
ProviderProfile::create(['user_id' => $provider->id, 'is_verified' => true]);
|
||||
ProviderProfile::create(['user_id' => $provider->id, 'verification_status' => 'approved']);
|
||||
return $provider;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class ProviderScheduleCrudTest extends TestCase
|
||||
private function makeProvider(): User
|
||||
{
|
||||
$provider = User::factory()->create(['role' => 'provider']);
|
||||
ProviderProfile::create(['user_id' => $provider->id, 'is_verified' => true]);
|
||||
ProviderProfile::create(['user_id' => $provider->id, 'verification_status' => 'approved']);
|
||||
return $provider;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user