From b73e686e48068cc0f670ad4de883113ac7a91a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sat, 14 Mar 2026 15:01:04 +0000 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=AE=A2=E5=8D=95=E5=88=97?= =?UTF-8?q?=E8=A1=A8=EF=BC=9A=E8=A1=A5=E9=BD=90BMPA=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0Top5=E9=95=BF=E5=8E=9F=E5=9B=A0=E4=B8=8D?= =?UTF-8?q?=E6=B8=B2=E6=9F=93keyword=E9=93=BE=E6=8E=A5=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...paFailedReasonTop5LongReasonNoLinkTest.php | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 tests/Feature/AdminPlatformOrderBmpaFailedReasonTop5LongReasonNoLinkTest.php diff --git a/tests/Feature/AdminPlatformOrderBmpaFailedReasonTop5LongReasonNoLinkTest.php b/tests/Feature/AdminPlatformOrderBmpaFailedReasonTop5LongReasonNoLinkTest.php new file mode 100644 index 0000000..2b4003a --- /dev/null +++ b/tests/Feature/AdminPlatformOrderBmpaFailedReasonTop5LongReasonNoLinkTest.php @@ -0,0 +1,80 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_bmpa_failed_reason_top5_long_reason_should_not_render_keyword_links(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'bmpa_failed_reason_long_reason_no_link_test', + 'name' => 'BMPA失败原因过长不渲染链接测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $reason = str_repeat('很长的BMPA失败原因', 30); // > 200 chars + $shown = mb_substr($reason, 0, 60); + + PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_BMPA_FAILED_LONG_REASON_0001', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'unpaid', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 10, + 'paid_amount' => 0, + 'placed_at' => now(), + 'meta' => [ + 'batch_mark_paid_and_activate_error' => [ + 'message' => $reason, + 'at' => now()->toDateTimeString(), + 'admin_id' => 1, + ], + ], + ]); + + $page = $this->get('/admin/platform-orders'); + $page->assertOk(); + + $page->assertSee('批量标记支付并生效失败原因 TOP5'); + $page->assertSee($shown); + $page->assertSee('原因过长,请复制到筛选框'); + + // 不应渲染 bmpa_error_keyword= 的链接(避免 URL 过长/特殊字符问题) + $page->assertDontSee('bmpa_error_keyword=', false); + + // 仍应给一个“进入失败集合”的入口 + $page->assertSee('进入失败集合'); + } +}