平台订单对账明细导出:支持 include_order_snapshot 并加入口
This commit is contained in:
@@ -83,15 +83,27 @@ class AdminPlatformOrderExportLedgerTest extends TestCase
|
||||
|
||||
$content = $res->streamedContent();
|
||||
|
||||
$res2 = $this->get('/admin/platform-orders/' . $order->id . '/export-ledger?include_order_snapshot=1');
|
||||
$res2->assertOk();
|
||||
|
||||
$content2 = $res2->streamedContent();
|
||||
|
||||
// UTF-8 BOM
|
||||
$this->assertStringStartsWith("\xEF\xBB\xBF", $content);
|
||||
$this->assertStringStartsWith("\xEF\xBB\xBF", $content2);
|
||||
|
||||
// 核心表头
|
||||
$this->assertStringContainsString('record_type,receipt_type,channel,amount,biz_time,created_at,admin_id,note', $content);
|
||||
$this->assertStringContainsString('record_type,receipt_type,channel,amount,biz_time,created_at,admin_id,note', $content2);
|
||||
|
||||
// 至少包含一条 payment 与一条 refund 行(包含 type 字段)
|
||||
$this->assertStringContainsString('payment,bank_transfer,offline,10', $content);
|
||||
$this->assertStringContainsString('refund,refund,offline,1', $content);
|
||||
|
||||
// include_order_snapshot=1 时应包含更多摘要字段
|
||||
$this->assertStringContainsString("merchant_id,{$merchant->id}", $content2);
|
||||
$this->assertStringContainsString('payment_status,unpaid', $content2);
|
||||
$this->assertStringContainsString('site_subscription_id,', $content2);
|
||||
}
|
||||
|
||||
public function test_show_page_should_render_export_ledger_link(): void
|
||||
@@ -131,6 +143,8 @@ class AdminPlatformOrderExportLedgerTest extends TestCase
|
||||
$res->assertOk();
|
||||
|
||||
$res->assertSee('/admin/platform-orders/' . $order->id . '/export-ledger', false);
|
||||
$res->assertSee('/admin/platform-orders/' . $order->id . '/export-ledger?include_order_snapshot=1', false);
|
||||
$res->assertSee('导出对账明细(CSV)', false);
|
||||
$res->assertSee('导出含订单摘要(CSV)', false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user