test: harden match live static contract

This commit is contained in:
hajimi
2026-06-21 11:40:49 +08:00
parent dbdb418e15
commit b133fd36ee
2 changed files with 19 additions and 0 deletions
@@ -14,7 +14,19 @@ $requiredTokens = [
'public static function syncLegacyLiveUrl', 'public static function syncLegacyLiveUrl',
'public static function getLiveListForApi', 'public static function getLiveListForApi',
'public static function buildStreamOptions', 'public static function buildStreamOptions',
'source_url',
'update_time',
"order('create_time', 'asc')",
"order('id', 'asc')",
'play_url_m3u8', 'play_url_m3u8',
'play_url_hd_m3u8',
'play_url_flv',
'play_url_hd_flv',
'M3U8',
'HD M3U8',
'FLV',
'HD FLV',
"if (\$url === '')",
'default_play_url', 'default_play_url',
]; ];
@@ -25,4 +37,9 @@ foreach ($requiredTokens as $needle) {
} }
} }
if (strpos($service, "whereNull('delete_time')") === false && strpos($service, 'SoftDelete') === false) {
fwrite(STDERR, "missing non-deleted row guard\n");
exit(1);
}
echo "service static checks passed\n"; echo "service static checks passed\n";
@@ -9,6 +9,7 @@ class MatchLiveService
{ {
public static function syncLegacyLiveUrl(int $matchId): void public static function syncLegacyLiveUrl(int $matchId): void
{ {
// MatchLive uses SoftDelete, so default queries only return non-deleted rows.
$row = MatchLive::where('match_id', $matchId) $row = MatchLive::where('match_id', $matchId)
->order('create_time', 'asc') ->order('create_time', 'asc')
->order('id', 'asc') ->order('id', 'asc')
@@ -22,6 +23,7 @@ class MatchLiveService
public static function getLiveListForApi(int $matchId): array public static function getLiveListForApi(int $matchId): array
{ {
// MatchLive uses SoftDelete, so default queries only return non-deleted rows.
$rows = MatchLive::where('match_id', $matchId) $rows = MatchLive::where('match_id', $matchId)
->order('create_time', 'asc') ->order('create_time', 'asc')
->order('id', 'asc') ->order('id', 'asc')