diff --git a/tests/Feature/AdminDashboardPlatformOrderTrend7dCardShouldRenderRowsTest.php b/tests/Feature/AdminDashboardPlatformOrderTrend7dCardShouldRenderRowsTest.php new file mode 100644 index 0000000..47067a2 --- /dev/null +++ b/tests/Feature/AdminDashboardPlatformOrderTrend7dCardShouldRenderRowsTest.php @@ -0,0 +1,38 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_dashboard_platform_order_trend_7d_card_should_render_rows(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin'); + $res->assertOk(); + + // 趋势卡(近7天)应存在,并渲染 7 天的行(即使当天无数据也补 0) + $res->assertSee('data-role="platform-order-trend-7d"', false); + + $html = (string) $res->getContent(); + + // 粗略计数:tbody 内应出现 7 次日期文本(YYYY-MM-DD) + preg_match_all('/\d{4}-\d{2}-\d{2}/', $html, $m); + $this->assertGreaterThanOrEqual(7, count($m[0] ?? [])); + } +}