Files
saasshop/tests/Feature/AdminDashboardMiniBarRowsShouldLinkToGovernanceScopesTest.php

48 lines
1.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminDashboardMiniBarRowsShouldLinkToGovernanceScopesTest 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_mini_bar_rows_should_link_to_expected_scopes_with_safe_back(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin');
$res->assertOk();
$html = (string) $res->getContent();
// 行可点击(漏斗 + 治理)
$this->assertStringContainsString('adm-mini-bar-row-link', $html);
// 漏斗:待支付 / 待生效 / 可同步
$this->assertStringContainsString('href="/admin/platform-orders?payment_status=unpaid&status=pending&back=%2Fadmin"', $html);
$this->assertStringContainsString('href="/admin/platform-orders?payment_status=paid&status=pending&sync_status=unsynced&back=%2Fadmin"', $html);
$this->assertStringContainsString('href="/admin/platform-orders?syncable_only=1&sync_status=unsynced&back=%2Fadmin"', $html);
// 治理:同步失败 / 无回执 / 续费缺订阅
$this->assertStringContainsString('href="/admin/platform-orders?sync_status=failed&back=%2Fadmin"', $html);
$this->assertStringContainsString('href="/admin/platform-orders?payment_status=paid&receipt_status=none&back=%2Fadmin"', $html);
$this->assertStringContainsString('href="/admin/platform-orders?renewal_missing_subscription=1&back=%2Fadmin"', $html);
// back 参数不得被 Blade escape 成 &amp;back避免 nested back/可读性问题)
$this->assertStringNotContainsString('&amp;back=', $html);
}
}