chore(admin): 平台订单下单页展示来源线索上下文提示

This commit is contained in:
萝卜
2026-03-14 04:23:21 +00:00
parent 19abd26dd9
commit e234465f6e
2 changed files with 97 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
<?php
namespace Tests\Feature;
use App\Models\Merchant;
use App\Models\Plan;
use App\Models\PlatformLead;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Arr;
use Tests\TestCase;
class AdminPlatformOrderFormShouldShowLeadContextHintTest 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_create_form_should_show_lead_context_badge_and_view_orders_link(): void
{
$this->loginAsPlatformAdmin();
$merchant = Merchant::query()->firstOrFail();
$plan = Plan::query()->create([
'code' => 'lead_context_form_plan',
'name' => '下单页线索提示测试套餐',
'billing_cycle' => 'monthly',
'price' => 10,
'list_price' => 10,
'status' => 'active',
'sort' => 10,
'published_at' => now(),
]);
$lead = PlatformLead::query()->create([
'name' => '线索提示',
'mobile' => '',
'email' => '',
'company' => '',
'source' => 'test',
'status' => 'new',
'plan_id' => $plan->id,
'meta' => ['merchant_id' => $merchant->id],
]);
$res = $this->get('/admin/platform-orders/create?' . Arr::query([
'merchant_id' => $merchant->id,
'plan_id' => $plan->id,
'lead_id' => $lead->id,
'back' => '/admin/platform-leads',
]));
$res->assertOk();
$res->assertSee('来源线索:#' . $lead->id, false);
// 入口应指向 platform-orders?lead_id=xxx可带 back
$res->assertSee('/admin/platform-orders?lead_id=' . $lead->id, false);
$res->assertSee('查看该线索关联订单', false);
}
}