test(admin-platform-order): guard batch forms disable-on-submit marker
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderIndexBatchFormsShouldDisableOnSubmitTest 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_platform_order_index_batch_forms_should_disable_on_submit(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$res = $this->get('/admin/platform-orders');
|
||||
$res->assertOk();
|
||||
|
||||
$html = (string) $res->getContent();
|
||||
|
||||
// 高风险批量动作:必须带 data-action="disable-on-submit",避免运营重复点击造成重复请求。
|
||||
$this->assertStringContainsString('action="/admin/platform-orders/batch-activate-subscriptions"', $html);
|
||||
$this->assertStringContainsString('action="/admin/platform-orders/batch-mark-paid-and-activate"', $html);
|
||||
$this->assertStringContainsString('action="/admin/platform-orders/batch-mark-activated"', $html);
|
||||
$this->assertStringContainsString('action="/admin/platform-orders/clear-sync-errors"', $html);
|
||||
$this->assertStringContainsString('action="/admin/platform-orders/clear-bmpa-errors"', $html);
|
||||
|
||||
// 至少出现多次(每个工具组含 filtered/all 两套表单)
|
||||
$this->assertTrue(substr_count($html, 'data-action="disable-on-submit"') >= 6);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user