From 4fafd80b75510347223a4c48ba464f9c6ef0ddc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Tue, 17 Mar 2026 21:37:30 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E8=AF=A6=E6=83=85=E9=A1=B5=E9=80=80?= =?UTF-8?q?=E6=AC=BE=E4=B8=8D=E4=B8=80=E8=87=B4=E6=B2=BB=E7=90=86=E5=9D=97?= =?UTF-8?q?=E5=BA=94=E5=8C=85=E5=90=AB=E4=B8=80=E9=94=AE=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...wRefundInconsistentGovernanceBlockTest.php | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 tests/Feature/AdminPlatformOrderShowRefundInconsistentGovernanceBlockTest.php diff --git a/tests/Feature/AdminPlatformOrderShowRefundInconsistentGovernanceBlockTest.php b/tests/Feature/AdminPlatformOrderShowRefundInconsistentGovernanceBlockTest.php new file mode 100644 index 0000000..34214da --- /dev/null +++ b/tests/Feature/AdminPlatformOrderShowRefundInconsistentGovernanceBlockTest.php @@ -0,0 +1,74 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_show_page_will_render_refund_inconsistent_governance_block_and_fix_link(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'refund_inconsistent_show_block_01', + 'name' => '退款不一致治理块测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 30, + 'list_price' => 30, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + // 不一致:refunded 但退款总额不足 + $order = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_REFUND_INCONS_SHOW_BLOCK_0001', + 'order_type' => 'new_purchase', + 'status' => 'activated', + 'payment_status' => 'refunded', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 30, + 'paid_amount' => 30, + 'placed_at' => now(), + 'paid_at' => now(), + 'activated_at' => now(), + 'refunded_at' => now(), + 'meta' => [ + 'refund_summary' => [ + 'count' => 1, + 'total_amount' => 10, + ], + ], + ]); + + $this->get('/admin/platform-orders/' . $order->id) + ->assertOk() + ->assertSee('退款不一致治理提示') + ->assertSee('去追加退款记录', false) + ->assertSee('#add-refund-receipt', false) + ->assertSee('/admin/platform-orders?refund_inconsistent=1', false); + } +}