update P15

This commit is contained in:
2026-04-01 12:44:52 +08:00
parent 73309d7890
commit 7c83fa4664
4 changed files with 206 additions and 4 deletions
@@ -201,6 +201,31 @@ class UserControllerTest extends TestCase
}
}
public function test_list_users_filter_by_role_id(): void
{
$admin_role = $this->fetchAdminRole();
$response = $this->get('/api/v1/users', ['role_id' => $admin_role->id], $this->authHeaders());
$response->assertStatus(200);
$response->assertJsonPath('code', 0);
$body = json_decode($response->getContent(), true);
$this->assertGreaterThanOrEqual(1, $body['data']['total']);
foreach ($body['data']['items'] as $item) {
$this->assertSame($admin_role->id, $item['role_id']);
}
}
public function test_list_users_filter_by_role_id_empty(): void
{
$response = $this->get('/api/v1/users', ['role_id' => 999999], $this->authHeaders());
$response->assertStatus(200);
$response->assertJsonPath('code', 0);
$response->assertJsonPath('data.total', 0);
}
// ========== 详情接口测试 ==========
public function test_show_user_returns_user_data(): void