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); + } +}