平台订单列表:快捷筛选链接保留上下文并清空 page
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderIndexQuickFilterLinksKeepContextTest 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_quick_filter_links_should_keep_context_and_clear_page(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
// 模拟:当前已筛选站点/套餐/订阅ID,并且带 page/back
|
||||
$res = $this->get('/admin/platform-orders?merchant_id=2&plan_id=3&site_subscription_id=4&page=9&back=%2Fadmin%2Fplans');
|
||||
$res->assertOk();
|
||||
|
||||
// 以“待支付”为例:应保留 merchant_id/plan_id/site_subscription_id/back,同时覆盖 payment_status=unpaid,并清除 page
|
||||
$res->assertSee('/admin/platform-orders?merchant_id=2&plan_id=3&site_subscription_id=4&back=%2Fadmin%2Fplans&payment_status=unpaid', false);
|
||||
$res->assertDontSee('page=9', false);
|
||||
|
||||
// “全部”应清空筛选,仅保留 back
|
||||
$res->assertSee('/admin/platform-orders?back=%2Fadmin%2Fplans', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user