feat(platform): 套餐页线索表单样式收敛(input 类)+ 线索提交测试
This commit is contained in:
54
tests/Feature/FrontPlatformLeadStoreTest.php
Normal file
54
tests/Feature/FrontPlatformLeadStoreTest.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Plan;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class FrontPlatformLeadStoreTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_can_submit_platform_lead_and_persist(): void
|
||||
{
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'front_lead_plan_01',
|
||||
'name' => '线索测试套餐',
|
||||
'billing_cycle' => 'monthly',
|
||||
'price' => 10,
|
||||
'list_price' => 10,
|
||||
'status' => 'active',
|
||||
'sort' => 10,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
$res = $this->post('/platform/leads', [
|
||||
'name' => '张三',
|
||||
'mobile' => '13800000000',
|
||||
'plan_id' => $plan->id,
|
||||
'source' => 'platform_plans',
|
||||
'note' => '想先试用一下',
|
||||
]);
|
||||
|
||||
$res->assertRedirect('/platform/plans');
|
||||
|
||||
$this->assertDatabaseHas('platform_leads', [
|
||||
'name' => '张三',
|
||||
'mobile' => '13800000000',
|
||||
'plan_id' => $plan->id,
|
||||
'source' => 'platform_plans',
|
||||
'status' => 'new',
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_submit_platform_lead_should_validate_required_name(): void
|
||||
{
|
||||
$res = $this->post('/platform/leads', [
|
||||
'name' => '',
|
||||
]);
|
||||
|
||||
$res->assertStatus(302);
|
||||
$res->assertSessionHasErrors(['name']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user