chore(governance): block batch BMPA when sync-governance filters present

This commit is contained in:
萝卜
2026-03-16 22:54:19 +08:00
parent 68735ee914
commit d68d0523b1
3 changed files with 65 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderIndexBatchBmpaButtonShouldDisableWhenSyncGovernanceFiltersPresentTest extends TestCase
{
use RefreshDatabase;
protected function loginAsPlatformAdmin(): void
{
$this->seed();
$this->post('/admin/login', [
'email' => 'platform.admin@demo.local',
'password' => 'Platform@123456',
])->assertRedirect('/admin');
}
public function test_batch_bmpa_button_should_disable_when_sync_governance_filters_present_even_if_pending_unpaid(): void
{
$this->loginAsPlatformAdmin();
// status=pending&payment_status=unpaid 是 BMPA 的基本口径;但叠加“同步失败”治理筛选应禁用(与后端阻断一致)。
$res = $this->get('/admin/platform-orders?status=pending&payment_status=unpaid&fail_only=1');
$res->assertOk();
$html = (string) $res->getContent();
$this->assertStringContainsString('批量标记支付并生效(含订阅同步)(当前筛选范围)', $html);
$this->assertStringContainsString('data-role="batch-bmpa-blocked-hint"', $html);
$this->assertStringContainsString('同步', $html);
// 按钮 disabled宽松断言
$this->assertTrue(str_contains($html, 'type="submit" disabled') || str_contains($html, 'disabled="disabled"'));
}
}