test: harden match live static contract
This commit is contained in:
@@ -14,7 +14,19 @@ $requiredTokens = [
|
||||
'public static function syncLegacyLiveUrl',
|
||||
'public static function getLiveListForApi',
|
||||
'public static function buildStreamOptions',
|
||||
'source_url',
|
||||
'update_time',
|
||||
"order('create_time', 'asc')",
|
||||
"order('id', 'asc')",
|
||||
'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',
|
||||
];
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -9,6 +9,7 @@ class MatchLiveService
|
||||
{
|
||||
public static function syncLegacyLiveUrl(int $matchId): void
|
||||
{
|
||||
// MatchLive uses SoftDelete, so default queries only return non-deleted rows.
|
||||
$row = MatchLive::where('match_id', $matchId)
|
||||
->order('create_time', 'asc')
|
||||
->order('id', 'asc')
|
||||
@@ -22,6 +23,7 @@ class MatchLiveService
|
||||
|
||||
public static function getLiveListForApi(int $matchId): array
|
||||
{
|
||||
// MatchLive uses SoftDelete, so default queries only return non-deleted rows.
|
||||
$rows = MatchLive::where('match_id', $matchId)
|
||||
->order('create_time', 'asc')
|
||||
->order('id', 'asc')
|
||||
|
||||
Reference in New Issue
Block a user