- 扩大玩家ID随机数位宽降低碰撞概率 - 授信额度变更加 lockForUpdate 防并发下调 - 结算冲正与入账利用唯一索引实现幂等闸门 - 失败登录计数加锁防丢失 - 代理子树查询改用子查询替代全表 pluck - 修复返点默认值百分比单位转换 - 测试中全量 fake 广播事件防 CI 500
This commit is contained in:
@@ -351,7 +351,9 @@ test('jackpot contribution uses total bet amount instead of actual deduct amount
|
||||
});
|
||||
|
||||
test('jackpot bursts by configured play combination trigger before threshold', function (): void {
|
||||
Event::fake([JackpotBurstBroadcast::class]);
|
||||
// 该 case 切到 reverb driver,必须 fake 流程中所有可能触发的 Broadcast 事件,
|
||||
// 否则 fake 列表外的广播会真实连接 Reverb/Pusher,在 CI 环境抛 500。
|
||||
Event::fake(allBroadcastEvents());
|
||||
config([
|
||||
'broadcasting.default' => 'reverb',
|
||||
'broadcasting.connections.reverb.driver' => 'reverb',
|
||||
|
||||
@@ -428,7 +428,9 @@ test('play type patch toggles active config and broadcasts instantly', function
|
||||
});
|
||||
|
||||
test('§9 play_config publish broadcasts changed play toggles', function (): void {
|
||||
Event::fake([PlayToggleBroadcast::class]);
|
||||
// fake 流程中可能触发的全部 Broadcast(PlayToggle / PlayCatalogUpdated / DrawStatusChange 等),
|
||||
// 否则未在 fake 列表中的事件会真实连接 Reverb/Pusher,CI 环境抛 500。
|
||||
Event::fake(allBroadcastEvents());
|
||||
config([
|
||||
'broadcasting.default' => 'reverb',
|
||||
'broadcasting.connections.reverb.driver' => 'reverb',
|
||||
@@ -459,7 +461,9 @@ test('§9 play_config publish broadcasts changed play toggles', function (): voi
|
||||
});
|
||||
|
||||
test('§9 odds publish broadcasts odds update', function (): void {
|
||||
Event::fake([OddsUpdateBroadcast::class]);
|
||||
// fake 流程中可能触发的全部 Broadcast(OddsUpdate / PlayCatalogUpdated / DrawStatusChange 等),
|
||||
// 否则未在 fake 列表中的事件会真实连接 Reverb/Pusher,CI 环境抛 500。
|
||||
Event::fake(allBroadcastEvents());
|
||||
config([
|
||||
'broadcasting.default' => 'reverb',
|
||||
'broadcasting.connections.reverb.driver' => 'reverb',
|
||||
|
||||
@@ -137,3 +137,32 @@ function ensureAdminActionCatalogSeeded(): void
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回项目内所有 Broadcast 事件类列表,供 Event::fake() 拦截广播使用。
|
||||
*
|
||||
* 业务切到 reverb driver 后,fake 列表不全会导致未拦截的 broadcast 真实派发、
|
||||
* 真实连接 Reverb/Pusher,CI 环境无可用 server 时直接 500。本 helper 保证:
|
||||
* Event::fake(allBroadcastEvents())
|
||||
* 一行覆盖流程中可能触发的所有事件。
|
||||
*
|
||||
* 不可使用 Event::fake() 无参形式:会同时拦截 Illuminate\Database\Events\* 等框架事件,
|
||||
* 干扰 RefreshDatabase / model events / 自定义 boot hooks。
|
||||
*
|
||||
* @return list<class-string>
|
||||
*/
|
||||
function allBroadcastEvents(): array
|
||||
{
|
||||
return [
|
||||
\App\Events\BalanceUpdateBroadcast::class,
|
||||
\App\Events\DrawCountdownBroadcast::class,
|
||||
\App\Events\DrawResultPublishedBroadcast::class,
|
||||
\App\Events\DrawStatusChangeBroadcast::class,
|
||||
\App\Events\JackpotBurstBroadcast::class,
|
||||
\App\Events\OddsUpdateBroadcast::class,
|
||||
\App\Events\PlayCatalogUpdatedBroadcast::class,
|
||||
\App\Events\PlayToggleBroadcast::class,
|
||||
\App\Events\RiskSoldOutBroadcast::class,
|
||||
\App\Events\RiskWarningBroadcast::class,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user