test: align batch sync receipt_status with receipt_status=none block
This commit is contained in:
@@ -38,11 +38,36 @@ class AdminPlatformOrderBatchActivateSubscriptionsReceiptStatusFilterFieldsTest
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
// 可同步 + 无回执
|
||||
$order = PlatformOrder::query()->create([
|
||||
// A:可同步 + 有回执
|
||||
$orderWithReceipt = PlatformOrder::query()->create([
|
||||
'merchant_id' => $merchant->id,
|
||||
'plan_id' => $plan->id,
|
||||
'order_no' => 'PO_BATCH_ACTIVATE_RECEIPT_NONE_0001',
|
||||
'order_no' => 'PO_BATCH_ACTIVATE_RECEIPT_HAS_0001',
|
||||
'order_type' => 'new_purchase',
|
||||
'status' => 'activated',
|
||||
'payment_status' => 'paid',
|
||||
'plan_name' => $plan->name,
|
||||
'billing_cycle' => $plan->billing_cycle,
|
||||
'period_months' => 1,
|
||||
'quantity' => 1,
|
||||
'payable_amount' => 10,
|
||||
'paid_amount' => 10,
|
||||
'placed_at' => now(),
|
||||
'paid_at' => now(),
|
||||
'activated_at' => now(),
|
||||
'meta' => [
|
||||
'payment_summary' => [
|
||||
'count' => 1,
|
||||
'total_amount' => 10,
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
// B:可同步 + 无回执(用于验证 receipt_status=has 不会误命中)
|
||||
$orderNoReceipt = PlatformOrder::query()->create([
|
||||
'merchant_id' => $merchant->id,
|
||||
'plan_id' => $plan->id,
|
||||
'order_no' => 'PO_BATCH_ACTIVATE_RECEIPT_NONE_0002',
|
||||
'order_type' => 'new_purchase',
|
||||
'status' => 'activated',
|
||||
'payment_status' => 'paid',
|
||||
@@ -59,22 +84,25 @@ class AdminPlatformOrderBatchActivateSubscriptionsReceiptStatusFilterFieldsTest
|
||||
]);
|
||||
|
||||
// 访问列表页:确保批量同步表单透传 receipt_status
|
||||
$page = $this->get('/admin/platform-orders?syncable_only=1&receipt_status=none');
|
||||
$page = $this->get('/admin/platform-orders?syncable_only=1&receipt_status=has');
|
||||
$page->assertOk();
|
||||
$page->assertSee('name="receipt_status"', false);
|
||||
$page->assertSee('value="none"', false);
|
||||
$page->assertSee('value="has"', false);
|
||||
|
||||
// 执行批量同步(filtered scope 且必须 syncable_only=1 才能提交)
|
||||
$res = $this->post('/admin/platform-orders/batch-activate-subscriptions', [
|
||||
'scope' => 'filtered',
|
||||
'syncable_only' => '1',
|
||||
'receipt_status' => 'none',
|
||||
'receipt_status' => 'has',
|
||||
'limit' => 50,
|
||||
]);
|
||||
|
||||
$res->assertRedirect();
|
||||
|
||||
$order->refresh();
|
||||
$this->assertNotEmpty(data_get($order->meta, 'subscription_activation.subscription_id'));
|
||||
$orderWithReceipt->refresh();
|
||||
$orderNoReceipt->refresh();
|
||||
|
||||
$this->assertNotEmpty(data_get($orderWithReceipt->meta, 'subscription_activation.subscription_id'));
|
||||
$this->assertEmpty(data_get($orderNoReceipt->meta, 'subscription_activation.subscription_id'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user