套餐列表:增加快捷筛选并仅保留上下文字段
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlanIndexQuickFilterLinksKeepContextTest 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_drop_other_filters(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
// 目前 plans/index 没有“快捷筛选”区块,这个测试先作为护栏:
|
||||
// 一旦我们加上快捷筛选,就要求它只保留上下文键(back/keyword),不继承 page。
|
||||
// 这里先访问带筛选与 page/back 的页面,确保不会出现携带 page 的快捷筛选链接(未来回归用)。
|
||||
$res = $this->get('/admin/plans?status=active&billing_cycle=monthly&keyword=abc&page=9&back=%2Fadmin%2Fplatform-orders');
|
||||
$res->assertOk();
|
||||
|
||||
$html = (string) $res->getContent();
|
||||
|
||||
// 当前版本没有快捷筛选区块:先断言页面中存在返回链接与新建套餐链接(保证页面渲染正常)
|
||||
$res->assertSee('套餐管理', false);
|
||||
$res->assertSee('/admin/plans/create?', false);
|
||||
|
||||
// 兜底护栏:页面中不应出现带 page=9 的“固定快捷筛选链接”(避免未来引入时误带 page)
|
||||
$this->assertStringNotContainsString('page=9', $html);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user