fix(platform-orders): make bmpa_success_only and bmpa_failed_only mutually exclusive
This commit is contained in:
@@ -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 + failed:Controller 侧应执行互斥清洗(失败优先),避免落入空集合。
|
||||
$html = $this->get('/admin/platform-orders?bmpa_failed_only=1&bmpa_success_only=1')
|
||||
->assertOk()
|
||||
->getContent();
|
||||
|
||||
// UI:success checkbox 不应保持 checked(已被清洗掉)
|
||||
$this->assertStringNotContainsString('name="bmpa_success_only" value="1" checked', $html);
|
||||
|
||||
// UI:failed checkbox 仍应 checked
|
||||
$this->assertStringContainsString('name="bmpa_failed_only" value="1" checked', $html);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user