From 32f939c3f4c9aa55f520b7d718c930e7089e9c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Tue, 17 Mar 2026 23:44:07 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E5=B9=B3=E5=8F=B0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E8=A1=8C=E7=BA=A7BMPA=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=9C=A8=E5=AF=B9=E8=B4=A6=E4=B8=8D=E4=B8=80=E8=87=B4=E6=97=B6?= =?UTF-8?q?=E5=BA=94=E7=A6=81=E7=94=A8=E5=B9=B6=E5=BC=95=E5=AF=BC=E6=B2=BB?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ShouldDisableWhenReconcileMismatchTest.php | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 tests/Feature/AdminPlatformOrderIndexRowMarkPaidAndActivateButtonShouldDisableWhenReconcileMismatchTest.php diff --git a/tests/Feature/AdminPlatformOrderIndexRowMarkPaidAndActivateButtonShouldDisableWhenReconcileMismatchTest.php b/tests/Feature/AdminPlatformOrderIndexRowMarkPaidAndActivateButtonShouldDisableWhenReconcileMismatchTest.php new file mode 100644 index 0000000..6eb8652 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderIndexRowMarkPaidAndActivateButtonShouldDisableWhenReconcileMismatchTest.php @@ -0,0 +1,80 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_row_mark_paid_and_activate_button_should_be_disabled_when_reconcile_mismatch(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'po_index_row_bmpa_disable_reconcile_mismatch_plan', + 'name' => '平台订单列表行级BMPA禁用(对账不一致)测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 30, + 'list_price' => 30, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + // 制造对账不一致:存在回执证据(payment_summary.total_amount),但与 paid_amount 不一致。 + $order = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_INDEX_ROW_BMPA_DISABLE_RECONCILE_MISMATCH_0001', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'paid', + '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(), + 'meta' => [ + 'payment_summary' => [ + 'count' => 1, + 'total_amount' => 10.00, + ], + ], + ]); + + $this->assertTrue($order->isReconcileMismatch()); + + $res = $this->get('/admin/platform-orders'); + $res->assertOk(); + + $html = (string) $res->getContent(); + $this->assertStringContainsString($order->order_no, $html); + + // 断言:该订单所在行的“标记支付并生效”按钮应被禁用(避免运营在列表页误触) + $pattern = '#/admin/platform-orders/' . $order->id . '/mark-paid-and-activate.*?]*disabled#s'; + $this->assertMatchesRegularExpression($pattern, $html); + + // 并且应提供最短治理入口(直达补回执面板) + $this->assertStringContainsString('#add-payment-receipt', $html); + } +}