fix(platform-orders): make bmpa_success_only and bmpa_failed_only mutually exclusive

This commit is contained in:
萝卜
2026-03-18 03:47:25 +08:00
parent 5ee3052280
commit 17e78c2ab2
2 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderBmpaFailedAndSuccessFiltersShouldBeMutuallyExclusiveTest 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_orders_bmpa_failed_and_success_filters_should_be_mutually_exclusive(): void
{
$this->loginAsPlatformAdmin();
// 同时传 success + failedController 侧应执行互斥清洗(失败优先),避免落入空集合。
$html = $this->get('/admin/platform-orders?bmpa_failed_only=1&bmpa_success_only=1')
->assertOk()
->getContent();
// UIsuccess checkbox 不应保持 checked已被清洗掉
$this->assertStringNotContainsString('name="bmpa_success_only" value="1" checked', $html);
// UIfailed checkbox 仍应 checked
$this->assertStringContainsString('name="bmpa_failed_only" value="1" checked', $html);
}
}