test: dashboard platform order trend 7d should render

This commit is contained in:
萝卜
2026-03-15 22:59:04 +08:00
parent b1e20c5138
commit 397789df92

View File

@@ -0,0 +1,38 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminDashboardPlatformOrderTrend7dCardShouldRenderRowsTest extends TestCase
{
use RefreshDatabase;
protected function loginAsPlatformAdmin(): void
{
$this->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] ?? []));
}
}