Platform orders export: include lead_id column
This commit is contained in:
@@ -211,5 +211,57 @@ class AdminPlatformOrderExportTest extends TestCase
|
||||
|
||||
$this->get('/admin/platform-orders/export')
|
||||
->assertRedirect('/admin/login');
|
||||
}
|
||||
}
|
||||
|
||||
public function test_platform_admin_can_export_platform_orders_csv_with_lead_id_column(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$merchant = Merchant::query()->firstOrFail();
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'export_order_lead_id_test',
|
||||
'name' => '导出线索ID测试套餐',
|
||||
'billing_cycle' => 'monthly',
|
||||
'price' => 10,
|
||||
'list_price' => 10,
|
||||
'status' => 'active',
|
||||
'sort' => 10,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
$lead = \App\Models\PlatformLead::query()->create([
|
||||
'name' => 'Lead Export',
|
||||
'mobile' => '13800000999',
|
||||
'company' => 'Export Inc',
|
||||
'status' => 'new',
|
||||
]);
|
||||
|
||||
PlatformOrder::query()->create([
|
||||
'merchant_id' => $merchant->id,
|
||||
'plan_id' => $plan->id,
|
||||
'order_no' => 'PO_EXPORT_LEAD_0001',
|
||||
'order_type' => 'new_purchase',
|
||||
'status' => 'pending',
|
||||
'payment_status' => 'unpaid',
|
||||
'plan_name' => $plan->name,
|
||||
'billing_cycle' => $plan->billing_cycle,
|
||||
'period_months' => 1,
|
||||
'quantity' => 1,
|
||||
'payable_amount' => 10,
|
||||
'paid_amount' => 0,
|
||||
'placed_at' => now(),
|
||||
'meta' => [
|
||||
'platform_lead_id' => $lead->id,
|
||||
],
|
||||
]);
|
||||
|
||||
$res = $this->get('/admin/platform-orders/export?download=1&lead_id=' . $lead->id);
|
||||
$res->assertOk();
|
||||
|
||||
$content = $res->streamedContent();
|
||||
$this->assertStringContainsString('线索ID', $content);
|
||||
$this->assertStringContainsString('PO_EXPORT_LEAD_0001', $content);
|
||||
$this->assertStringContainsString((string) $lead->id, $content);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user