feat(front): 官网套餐页提交开通意向线索(PlatformLead)

This commit is contained in:
萝卜
2026-03-14 02:31:28 +00:00
parent e1822e4389
commit 249ffb3aba
7 changed files with 201 additions and 12 deletions

View File

@@ -0,0 +1,48 @@
<?php
namespace Tests\Feature;
use App\Models\Plan;
use App\Models\PlatformLead;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class FrontPlatformLeadSubmitTest extends TestCase
{
use RefreshDatabase;
public function test_platform_can_submit_lead_and_redirect_back_to_plans(): void
{
$this->seed();
$plan = Plan::query()->create([
'code' => 'front_lead_plan_01',
'name' => '线索提交测试套餐',
'billing_cycle' => 'monthly',
'price' => 99,
'list_price' => 99,
'status' => 'active',
'sort' => 10,
'published_at' => now(),
]);
$res = $this->post('/platform/leads', [
'name' => '张三',
'mobile' => '13800000000',
'company' => '测试公司',
'plan_id' => $plan->id,
'source' => 'platform_plans',
]);
$res->assertRedirect('/platform/plans');
$lead = PlatformLead::query()->latest('id')->first();
$this->assertNotNull($lead);
$this->assertSame('张三', $lead->name);
$this->assertSame('13800000000', $lead->mobile);
$this->assertSame('测试公司', $lead->company);
$this->assertSame($plan->id, $lead->plan_id);
$this->assertSame('platform_plans', $lead->source);
$this->assertSame('new', $lead->status);
}
}

View File

@@ -9,16 +9,21 @@ class FrontPlatformPagesUseExternalCssTest extends TestCase
{
use RefreshDatabase;
public function test_platform_pages_should_link_platform_css_and_not_inline_style_block(): void
public function test_platform_index_should_use_external_css_and_not_inline_style_block(): void
{
$res1 = $this->get('/platform');
$res1->assertOk();
$res1->assertSee('<link rel="stylesheet" href="/css/platform.css">', false);
$res1->assertDontSee('<style>', false);
$res = $this->get('/platform');
$res->assertOk();
$res2 = $this->get('/platform/plans');
$res2->assertOk();
$res2->assertSee('<link rel="stylesheet" href="/css/platform.css">', false);
$res2->assertDontSee('<style>', false);
$res->assertSee('/css/platform.css', false);
$res->assertDontSee('<style>', false);
}
public function test_platform_plans_should_use_external_css_and_not_inline_style_block(): void
{
$res = $this->get('/platform/plans');
$res->assertOk();
$res->assertSee('/css/platform.css', false);
$res->assertDontSee('<style>', false);
}
}