From 24e4aaf119b81d6125a3f20b6dab3e5ecd320eb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Wed, 18 Mar 2026 14:09:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95:=20=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E7=9B=98=E6=8E=92=E8=A1=8C=E8=BF=B7=E4=BD=A0=E5=9B=BE=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E7=AB=99=E7=82=B9=E9=93=BE=E6=8E=A5=E6=8A=A4=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...niChartShouldHaveLinkSourceInTableTest.php | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tests/Feature/AdminDashboardMerchantRevenueRank7dMiniChartShouldHaveLinkSourceInTableTest.php diff --git a/tests/Feature/AdminDashboardMerchantRevenueRank7dMiniChartShouldHaveLinkSourceInTableTest.php b/tests/Feature/AdminDashboardMerchantRevenueRank7dMiniChartShouldHaveLinkSourceInTableTest.php new file mode 100644 index 0000000..f5a68ee --- /dev/null +++ b/tests/Feature/AdminDashboardMerchantRevenueRank7dMiniChartShouldHaveLinkSourceInTableTest.php @@ -0,0 +1,65 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_rank_mini_chart_should_have_link_source_in_table(): void + { + Cache::flush(); + + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $platformAdminId = (int) Admin::query()->where('email', 'platform.admin@demo.local')->value('id'); + + PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => null, + 'site_subscription_id' => null, + 'created_by_admin_id' => $platformAdminId ?: null, + 'order_no' => 'PO_DASH_RANK_CHART_LINK_0001', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'paid', + 'payable_amount' => 10, + 'paid_amount' => 10, + 'placed_at' => now(), + 'meta' => [], + ]); + + Cache::flush(); + + $res = $this->get('/admin'); + $res->assertOk(); + + // 迷你排行(JS 渐进增强)复用表格中站点链接口径,因此这里做“表格链接存在”护栏。 + $res->assertSee('data-role="merchant-revenue-rank-7d"', false); + $res->assertSee('data-role="merchant-revenue-rank-7d-chart"', false); + + // 表格中站点名称应为可点击链接,且带 merchant_id 与近7天范围。 + $res->assertSee($merchant->name, false); + $res->assertSee('merchant_id=' . (int) $merchant->id, false); + $res->assertSee('created_from=', false); + $res->assertSee('created_to=', false); + } +}