完善职务礼包红包默认配置

This commit is contained in:
2026-04-24 23:09:32 +08:00
parent 4486a87326
commit 5273b4ee4b
12 changed files with 394 additions and 93 deletions
+13 -12
View File
@@ -336,15 +336,14 @@ class ChatControllerTest extends TestCase
}
/**
* 测试站长即使没有在职职务,也能看到管理菜单中的刷新全员按钮。
* 测试站长有在职职务权限时能看到管理菜单中的刷新全员按钮。
*/
public function test_room_view_shows_refresh_all_button_for_site_owner(): void
public function test_room_view_shows_refresh_all_button_for_positioned_site_owner(): void
{
$room = Room::create(['room_name' => 'owner-rf']);
$user = User::factory()->create([
'id' => 1,
'user_level' => 100,
]);
$user = $this->createUserWithPositionPermissions([
PositionPermissionRegistry::ROOM_CLEAR_SCREEN,
], ['id' => 1, 'user_level' => 100]);
$response = $this->actingAs($user)->get(route('chat.room', $room->id));
@@ -804,11 +803,13 @@ class ChatControllerTest extends TestCase
}
/**
* 测试管理员可以设置房间公告。
* 测试拥有公告权限的职务用户可以设置房间公告。
*/
public function test_site_owner_can_set_announcement()
public function test_position_user_can_set_announcement()
{
$user = User::factory()->create(['id' => 1, 'user_level' => 100]);
$user = $this->createUserWithPositionPermissions([
PositionPermissionRegistry::ROOM_ANNOUNCEMENT,
]);
$room = Room::create(['room_name' => 'test_ann', 'room_owner' => 'someone']);
$response = $this->actingAs($user)->postJson(route('chat.announcement', $room->id), [
@@ -873,11 +874,11 @@ class ChatControllerTest extends TestCase
*
* @param list<string> $permissions
*/
private function createUserWithPositionPermissions(array $permissions): User
private function createUserWithPositionPermissions(array $permissions, array $attributes = []): User
{
$user = User::factory()->create([
$user = User::factory()->create(array_merge([
'user_level' => 70,
]);
], $attributes));
$department = Department::create([
'name' => '聊天室测试部门'.$user->id,