feat(admin): 线索页补齐创建续费订单入口(require_subscription)
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Plan;
|
||||
use App\Models\PlatformLead;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformLeadIndexCreateRenewalOrderLinkTest 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_platform_lead_index_should_include_create_renewal_order_link(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'lead_index_create_renewal_plan',
|
||||
'name' => '线索页创建续费订单入口测试套餐',
|
||||
'billing_cycle' => 'monthly',
|
||||
'price' => 10,
|
||||
'list_price' => 10,
|
||||
'status' => 'active',
|
||||
'sort' => 10,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
$lead = PlatformLead::query()->create([
|
||||
'status' => 'new',
|
||||
'name' => '张三',
|
||||
'mobile' => '13800000000',
|
||||
'email' => 'zs@example.com',
|
||||
'company' => '测试公司',
|
||||
'plan_id' => $plan->id,
|
||||
'source' => 'test',
|
||||
'meta' => [],
|
||||
]);
|
||||
|
||||
$res = $this->get('/admin/platform-leads');
|
||||
$res->assertOk();
|
||||
|
||||
$html = (string) $res->getContent();
|
||||
|
||||
$this->assertStringContainsString('创建续费订单', $html);
|
||||
$this->assertStringContainsString('/admin/platform-orders/create?', $html);
|
||||
$this->assertStringContainsString('require_subscription=1', $html);
|
||||
$this->assertStringContainsString('lead_id=' . $lead->id, $html);
|
||||
$this->assertStringContainsString('plan_id=' . $plan->id, $html);
|
||||
$this->assertStringContainsString('back=' . urlencode('/admin/platform-leads'), $html);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user