测试: 升级批量生效阻断提示语义护栏

This commit is contained in:
萝卜
2026-03-18 20:05:48 +08:00
parent 4d1b19b295
commit 0c3c5abc14

View File

@@ -23,16 +23,27 @@ class AdminPlatformOrderIndexBatchMarkActivatedBlockedHintShouldIncludeGoPending
{
$this->loginAsPlatformAdmin();
// 构造一个会触发 batch_mark_activated 被阻断的筛选:缺少 sync_status=unsynced。
$res = $this->get('/admin/platform-orders?payment_status=paid&status=pending');
// 构造一个会触发 batch_mark_activated 被阻断的复杂筛选;
// blocked hint 应给出“切到待生效集合”入口,并清理冲突开关。
$res = $this->get('/admin/platform-orders?payment_status=paid&status=pending&sync_status=failed&bmpa_failed_only=1&page=2&back=/admin');
$res->assertOk();
$html = (string) $res->getContent();
$this->assertStringContainsString('data-role="batch-mark-activated-blocked-hint"', $html);
$this->assertStringContainsString('切到待生效集合', $html);
$this->assertStringContainsString('payment_status=paid', $html);
$this->assertStringContainsString('status=pending', $html);
$this->assertStringContainsString('sync_status=unsynced', $html);
$this->assertMatchesRegularExpression('/href="([^"]+)"[^>]*>切到待生效集合<\/a>/', $html);
preg_match('/href="([^"]+)"[^>]*>切到待生效集合<\/a>/', $html, $m);
$href = html_entity_decode((string) ($m[1] ?? ''));
$query = parse_url($href, PHP_URL_QUERY) ?: '';
parse_str($query, $q);
$this->assertSame('paid', (string) ($q['payment_status'] ?? ''));
$this->assertSame('pending', (string) ($q['status'] ?? ''));
$this->assertSame('unsynced', (string) ($q['sync_status'] ?? ''));
$this->assertSame('/admin', (string) ($q['back'] ?? ''));
$this->assertArrayNotHasKey('page', $q);
$this->assertArrayNotHasKey('bmpa_failed_only', $q);
}
}