feat(platform): 线索/订单页增加 back 与来源线索上下文提示

This commit is contained in:
萝卜
2026-03-14 04:50:45 +00:00
parent 6c0093c90e
commit 686c46a649
4 changed files with 168 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Arr;
use Tests\TestCase;
class AdminPlatformLeadIndexBackLinkNotEscapedTest 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_index_should_render_back_link_with_ampersand_not_escaped(): void
{
$this->loginAsPlatformAdmin();
$back = '/admin/platform-orders?' . Arr::query([
'lead_id' => 12,
'payment_status' => 'paid',
]);
$url = '/admin/platform-leads?' . Arr::query([
'back' => $back,
]);
$res = $this->get($url);
$res->assertOk();
$res->assertSee('← 返回上一页(保留上下文)', false);
$res->assertSee('href="' . $back . '"', false);
$res->assertDontSee('&amp;', false);
}
}