From d953094ecf8d33e308e266f10d2c20ab56b8ca6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Wed, 18 Mar 2026 20:24:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95:=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E6=B8=85=E7=90=86=E5=A4=B1=E8=B4=A5=E6=A0=87=E8=AE=B0=E9=98=BB?= =?UTF-8?q?=E6=96=AD=E6=8F=90=E7=A4=BA=E8=AF=AD=E4=B9=89=E6=8A=A4=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...dHintShouldIncludeGoBmpaFailedLinkTest.php | 22 +++++++++++++++---- ...ockedHintShouldIncludeGoFailedLinkTest.php | 21 ++++++++++++++---- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/tests/Feature/AdminPlatformOrderIndexClearBmpaBlockedHintShouldIncludeGoBmpaFailedLinkTest.php b/tests/Feature/AdminPlatformOrderIndexClearBmpaBlockedHintShouldIncludeGoBmpaFailedLinkTest.php index 9ae82e4..6edbd92 100644 --- a/tests/Feature/AdminPlatformOrderIndexClearBmpaBlockedHintShouldIncludeGoBmpaFailedLinkTest.php +++ b/tests/Feature/AdminPlatformOrderIndexClearBmpaBlockedHintShouldIncludeGoBmpaFailedLinkTest.php @@ -23,14 +23,28 @@ class AdminPlatformOrderIndexClearBmpaBlockedHintShouldIncludeGoBmpaFailedLinkTe { $this->loginAsPlatformAdmin(); - // 构造一个会触发 clear_bmpa_errors 被阻断的筛选:不在 BMPA 失败集合。 - $res = $this->get('/admin/platform-orders'); + // 构造会触发 clear_bmpa_errors 被阻断的复杂上下文; + // blocked hint 应给出“切到 BMPA 失败集合”入口,并保留 back、清空 page、清理同步失败冲突开关。 + $res = $this->get('/admin/platform-orders?fail_only=1&sync_status=failed&synced_only=1&page=2&back=/admin'); $res->assertOk(); $html = (string) $res->getContent(); $this->assertStringContainsString('data-role="clear-bmpa-errors-blocked-hint"', $html); - $this->assertStringContainsString('切到 BMPA 失败集合', $html); - $this->assertStringContainsString('bmpa_failed_only=1', $html); + $this->assertMatchesRegularExpression('/href="([^"]+)"[^>]*>切到 BMPA 失败集合<\/a>/', $html); + + preg_match('/href="([^"]+)"[^>]*>切到 BMPA 失败集合<\/a>/', $html, $m); + $href = html_entity_decode((string) ($m[1] ?? '')); + + $query = parse_url($href, PHP_URL_QUERY) ?: ''; + parse_str($query, $q); + + $this->assertSame('1', (string) ($q['bmpa_failed_only'] ?? '')); + $this->assertSame('/admin', (string) ($q['back'] ?? '')); + $this->assertArrayNotHasKey('page', $q); + $this->assertArrayNotHasKey('fail_only', $q); + $this->assertArrayNotHasKey('sync_status', $q); + $this->assertArrayNotHasKey('sync_error_keyword', $q); + $this->assertArrayNotHasKey('synced_only', $q); } } diff --git a/tests/Feature/AdminPlatformOrderIndexClearSyncBlockedHintShouldIncludeGoFailedLinkTest.php b/tests/Feature/AdminPlatformOrderIndexClearSyncBlockedHintShouldIncludeGoFailedLinkTest.php index 2ada8fa..393c5e7 100644 --- a/tests/Feature/AdminPlatformOrderIndexClearSyncBlockedHintShouldIncludeGoFailedLinkTest.php +++ b/tests/Feature/AdminPlatformOrderIndexClearSyncBlockedHintShouldIncludeGoFailedLinkTest.php @@ -23,14 +23,27 @@ class AdminPlatformOrderIndexClearSyncBlockedHintShouldIncludeGoFailedLinkTest e { $this->loginAsPlatformAdmin(); - // 构造一个会触发 clear_sync_errors 被阻断的筛选:不在失败集合。 - $res = $this->get('/admin/platform-orders'); + // 构造会触发 clear_sync_errors 被阻断的复杂上下文; + // blocked hint 应给出“切到同步失败集合”入口,并保留 back、清空 page、清理 BMPA 冲突开关。 + $res = $this->get('/admin/platform-orders?bmpa_failed_only=1&syncable_only=1&page=2&back=/admin'); $res->assertOk(); $html = (string) $res->getContent(); $this->assertStringContainsString('data-role="clear-sync-errors-blocked-hint"', $html); - $this->assertStringContainsString('切到同步失败集合', $html); - $this->assertStringContainsString('sync_status=failed', $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('failed', (string) ($q['sync_status'] ?? '')); + $this->assertSame('/admin', (string) ($q['back'] ?? '')); + $this->assertArrayNotHasKey('page', $q); + $this->assertArrayNotHasKey('bmpa_failed_only', $q); + $this->assertArrayNotHasKey('bmpa_error_keyword', $q); + $this->assertArrayNotHasKey('syncable_only', $q); } }