fix(admin-dashboard): billing workbench links use selfWithoutBack for back param

This commit is contained in:
萝卜
2026-03-16 18:25:44 +08:00
parent 9ac3b32e0e
commit 88347d1185
2 changed files with 42 additions and 10 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminDashboardBillingWorkbenchLinksShouldUseSelfWithoutBackTest 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_dashboard_billing_workbench_links_should_use_self_without_back(): void
{
$this->loginAsPlatformAdmin();
// 模拟“带 back 进入仪表盘”的场景;仪表盘内部入口应仍返回 /adminselfWithoutBack而不是沿用 incoming back。
$res = $this->get('/admin?back=/admin/platform-orders');
$res->assertOk();
// 断言:工作台入口链接应带 back=%2Fadmin而不是 back=%2Fadmin%2Fplatform-orders
$res->assertSee('back=%2Fadmin', false);
$res->assertDontSee('back=%2Fadmin%2Fplatform-orders', false);
}
}