新增聊天室刷新同步与全员刷新功能
This commit is contained in:
@@ -215,6 +215,41 @@ class ChatControllerTest extends TestCase
|
||||
$response->assertDontSee("runAdminAction('announce-message')", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试站长即使没有在职职务,也能看到管理菜单中的刷新全员按钮。
|
||||
*/
|
||||
public function test_room_view_shows_refresh_all_button_for_site_owner(): void
|
||||
{
|
||||
$room = Room::create(['room_name' => 'owner-rf']);
|
||||
$user = User::factory()->create([
|
||||
'id' => 1,
|
||||
'user_level' => 100,
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($user)->get(route('chat.room', $room->id));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertSee('🛠 管理', false);
|
||||
$response->assertSee("runAdminAction('refresh-all')", false);
|
||||
$response->assertSee('♻️ 刷新全员', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试普通职务用户不会看到刷新全员按钮。
|
||||
*/
|
||||
public function test_room_view_hides_refresh_all_button_for_non_site_owner(): void
|
||||
{
|
||||
$room = Room::create(['room_name' => 'normal-rf']);
|
||||
$user = $this->createUserWithPositionPermissions([
|
||||
PositionPermissionRegistry::ROOM_ANNOUNCEMENT,
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($user)->get(route('chat.room', $room->id));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertDontSee("runAdminAction('refresh-all')", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试用户可以发送普通文本消息。
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user