测试: 治理提示区跨集合链接清理冲突开关护栏
This commit is contained in:
@@ -68,4 +68,29 @@ class AdminPlatformOrderToolsBmpaGovernanceHintTest extends TestCase
|
|||||||
$res->assertSee('进入批量标记支付失败集合', false);
|
$res->assertSee('进入批量标记支付失败集合', false);
|
||||||
$res->assertSee('切到可BMPA处理(用于重试)', false);
|
$res->assertSee('切到可BMPA处理(用于重试)', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_tools_go_bmpa_failed_link_should_clear_sync_failed_filters_when_cross_context(): void
|
||||||
|
{
|
||||||
|
$this->loginAsPlatformAdmin();
|
||||||
|
|
||||||
|
// 模拟用户在同步失败上下文中又叠加了 BMPA 失败筛选;
|
||||||
|
// 此时“进入批量标记支付失败集合”的链接应显式清理 fail_only/sync_status/sync_error_keyword,避免跳转后产生筛选冲突。
|
||||||
|
$res = $this->get('/admin/platform-orders?bmpa_failed_only=1&sync_status=failed');
|
||||||
|
$res->assertOk();
|
||||||
|
|
||||||
|
$html = (string) $res->getContent();
|
||||||
|
|
||||||
|
$this->assertMatchesRegularExpression('/href="([^"]+)"[^>]*>进入批量标记支付失败集合<\/a>/', $html);
|
||||||
|
|
||||||
|
preg_match('/href="([^"]+)"[^>]*>进入批量标记支付失败集合<\/a>/', $html, $m);
|
||||||
|
$href = html_entity_decode($m[1] ?? '');
|
||||||
|
|
||||||
|
$query = parse_url($href, PHP_URL_QUERY) ?: '';
|
||||||
|
parse_str($query, $q);
|
||||||
|
|
||||||
|
$this->assertSame('1', (string) ($q['bmpa_failed_only'] ?? ''));
|
||||||
|
$this->assertArrayNotHasKey('sync_status', $q);
|
||||||
|
$this->assertArrayNotHasKey('sync_error_keyword', $q);
|
||||||
|
$this->assertArrayNotHasKey('fail_only', $q);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,4 +62,29 @@ class AdminPlatformOrderToolsGovernanceHintTest extends TestCase
|
|||||||
->assertSee('sync_status=failed', false)
|
->assertSee('sync_status=failed', false)
|
||||||
->assertSee('syncable_only=1', false);
|
->assertSee('syncable_only=1', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_tools_go_sync_failed_link_should_clear_bmpa_filters_when_cross_context(): void
|
||||||
|
{
|
||||||
|
$this->loginAsPlatformAdmin();
|
||||||
|
|
||||||
|
// 模拟用户在 BMPA 失败上下文中又叠加了同步失败筛选;
|
||||||
|
// 此时“进入同步失败集合”的链接应显式清理 bmpa_failed_only/bmpa_error_keyword,避免跳转后产生筛选冲突。
|
||||||
|
$res = $this->get('/admin/platform-orders?sync_status=failed&bmpa_failed_only=1');
|
||||||
|
$res->assertOk();
|
||||||
|
|
||||||
|
$html = (string) $res->getContent();
|
||||||
|
|
||||||
|
// 只校验“进入同步失败集合”这一条链接本身的 query(避免页面其它区域也出现类似组合链接导致误报)
|
||||||
|
$this->assertMatchesRegularExpression('/href="([^"]+)"[^>]*>进入同步失败集合<\/a>/', $html);
|
||||||
|
|
||||||
|
preg_match('/href="([^"]+)"[^>]*>进入同步失败集合<\/a>/', $html, $m);
|
||||||
|
$href = html_entity_decode($m[1] ?? '');
|
||||||
|
|
||||||
|
$query = parse_url($href, PHP_URL_QUERY) ?: '';
|
||||||
|
parse_str($query, $q);
|
||||||
|
|
||||||
|
$this->assertSame('failed', (string) ($q['sync_status'] ?? ''));
|
||||||
|
$this->assertArrayNotHasKey('bmpa_failed_only', $q);
|
||||||
|
$this->assertArrayNotHasKey('bmpa_error_keyword', $q);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user