修复在线名单职务图标显示
This commit is contained in:
@@ -124,6 +124,31 @@ class ChatControllerTest extends TestCase
|
||||
$this->assertFalse($channelCallback($user, (string) $room->id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试聊天室 Presence 频道会返回当前在职职务图标与名称。
|
||||
*/
|
||||
public function test_room_presence_channel_returns_active_position_payload(): void
|
||||
{
|
||||
$room = Room::create([
|
||||
'room_name' => 'posbadge',
|
||||
'door_open' => true,
|
||||
]);
|
||||
$user = $this->createUserWithPositionPermissions([]);
|
||||
$position = $user->activePosition()->with('position.department')->first()?->position;
|
||||
$channelCallback = Broadcast::driver()->getChannels()->get('room.{roomId}');
|
||||
|
||||
$this->assertIsCallable($channelCallback);
|
||||
|
||||
$this->actingAs($user)->get(route('chat.room', $room->id));
|
||||
|
||||
$authorizedPayload = $channelCallback($user, (string) $room->id);
|
||||
|
||||
$this->assertIsArray($authorizedPayload);
|
||||
$this->assertSame('🛡️', $authorizedPayload['position_icon'] ?? null);
|
||||
$this->assertSame($position?->name, $authorizedPayload['position_name'] ?? null);
|
||||
$this->assertSame($position?->department?->name, $authorizedPayload['department_name'] ?? null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试主干默认聊天室页面不会渲染虚拟形象挂载点和配置。
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user