From 842d124c3afd50908c6aede8ea314c80a3db3225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Wed, 18 Mar 2026 19:13:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95:=20=E8=A1=A5=E9=BD=90?= =?UTF-8?q?=E6=91=98=E8=A6=81=E5=8C=BA=E6=80=BB=E6=95=B0=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E6=8A=A4=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/platform_orders/index.blade.php | 4 +- ...sLinkShouldHaveDataRoleAndKeepBackTest.php | 47 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/AdminPlatformOrderIndexSummaryTotalOrdersLinkShouldHaveDataRoleAndKeepBackTest.php diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index 58f0320..1f5e078 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -641,7 +641,9 @@

平台订单总数

-
{{ $summaryStats['total_orders'] ?? 0 }}
+

已支付 / 已生效

diff --git a/tests/Feature/AdminPlatformOrderIndexSummaryTotalOrdersLinkShouldHaveDataRoleAndKeepBackTest.php b/tests/Feature/AdminPlatformOrderIndexSummaryTotalOrdersLinkShouldHaveDataRoleAndKeepBackTest.php new file mode 100644 index 0000000..81e6453 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderIndexSummaryTotalOrdersLinkShouldHaveDataRoleAndKeepBackTest.php @@ -0,0 +1,47 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_platform_orders_index_summary_total_orders_link_should_have_data_role_and_keep_back(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin/platform-orders?merchant_id=1&plan_id=2&back=/admin&page=2'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + $re = '/]*data-role="po-summary-link-total-orders"[^>]*href="([^"]+)"/u'; + $this->assertMatchesRegularExpression($re, $html); + preg_match($re, $html, $m); + + $rawHref = (string) ($m[1] ?? ''); + $this->assertStringNotContainsString('&back=', $rawHref); + + $href = html_entity_decode($rawHref); + $query = parse_url($href, PHP_URL_QUERY) ?: ''; + parse_str($query, $q); + + $this->assertSame('1', (string) ($q['merchant_id'] ?? '')); + $this->assertSame('2', (string) ($q['plan_id'] ?? '')); + $this->assertSame('/admin', (string) ($q['back'] ?? '')); + $this->assertArrayNotHasKey('page', $q); + } +}