Files
saasshop/tests/Feature/AdminPlatformLeadIndexShouldIncludePaidNoReceiptGovernanceLinkTest.php
2026-03-18 22:03:28 +08:00

57 lines
1.8 KiB
PHP

<?php
namespace Tests\Feature;
use App\Models\Plan;
use App\Models\PlatformLead;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformLeadIndexShouldIncludePaidNoReceiptGovernanceLinkTest 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_paid_no_receipt_governance_link(): void
{
$this->loginAsPlatformAdmin();
$plan = Plan::query()->create([
'code' => 'lead_index_paid_no_receipt_plan',
'name' => '线索页已付无回执治理入口测试套餐',
'billing_cycle' => 'monthly',
'price' => 99,
'list_price' => 99,
'status' => 'active',
'sort' => 10,
'published_at' => now(),
]);
$lead = PlatformLead::query()->create([
'name' => '线索已付无回执测试',
'mobile' => '13900000001',
'email' => 'lead-paid-no-receipt@example.com',
'company' => '线索治理测试公司',
'plan_id' => $plan->id,
'source' => 'web',
'status' => 'new',
]);
$res = $this->get('/admin/platform-leads');
$res->assertOk();
$html = (string) $res->getContent();
$this->assertStringContainsString('已付无回执', $html);
$this->assertStringContainsString('/admin/platform-orders?lead_id=' . $lead->id . '&payment_status=paid&receipt_status=none&back=' . urlencode('/admin/platform-leads'), $html);
}
}