Files
saasshop/tests/Feature/AdminDashboardBillingWorkbenchLinksShouldUseSelfWithoutBackTest.php

35 lines
1.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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);
}
}