test: dashboard platform order trend 7d should render
This commit is contained in:
@@ -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] ?? []));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user