From b79e5bc1122875b7a3d1aa8044dcecdde4382587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Wed, 18 Mar 2026 14:54:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95:=20=E5=B7=B2=E4=BB=98?= =?UTF-8?q?=E6=97=A0=E5=9B=9E=E6=89=A7=E7=AD=9B=E9=80=89=E5=BA=94=E5=8F=AF?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...terPaidNoReceiptShouldBeFilterableTest.php | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 tests/Feature/AdminPlatformOrderIndexQuickFilterPaidNoReceiptShouldBeFilterableTest.php diff --git a/tests/Feature/AdminPlatformOrderIndexQuickFilterPaidNoReceiptShouldBeFilterableTest.php b/tests/Feature/AdminPlatformOrderIndexQuickFilterPaidNoReceiptShouldBeFilterableTest.php new file mode 100644 index 0000000..f4502b2 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderIndexQuickFilterPaidNoReceiptShouldBeFilterableTest.php @@ -0,0 +1,91 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_paid_no_receipt_filter_should_show_only_paid_orders_without_receipts(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'po_paid_no_receipt_filter_plan', + 'name' => '已付无回执筛选测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + // A: 已付 + 无回执(应命中) + PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_PAID_NO_RECEIPT_OK_0001', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'paid', + 'payable_amount' => 10, + 'paid_amount' => 10, + 'meta' => [ + // 无 payment_summary / payment_receipts + ], + ]); + + // B: 已付 + 有回执(不应命中) + PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_PAID_NO_RECEIPT_NO_0001', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'paid', + 'payable_amount' => 10, + 'paid_amount' => 10, + 'meta' => [ + 'payment_summary' => ['total_amount' => 10], + ], + ]); + + // C: 未付 + 无回执(不应命中,因为入口是“已付无回执”) + PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_PAID_NO_RECEIPT_NO_0002', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'unpaid', + 'payable_amount' => 10, + 'paid_amount' => 0, + 'meta' => [], + ]); + + $res = $this->get('/admin/platform-orders?payment_status=paid&receipt_status=none'); + $res->assertOk(); + + $res->assertSee('PO_PAID_NO_RECEIPT_OK_0001', false); + $res->assertDontSee('PO_PAID_NO_RECEIPT_NO_0001', false); + $res->assertDontSee('PO_PAID_NO_RECEIPT_NO_0002', false); + } +}