Platform order show: add guardrail for governance actions anchor

This commit is contained in:
萝卜
2026-03-18 06:43:49 +08:00
parent c40274f3d1
commit 4f795bc93d

View File

@@ -0,0 +1,64 @@
<?php
namespace Tests\Feature;
use App\Models\Merchant;
use App\Models\Plan;
use App\Models\PlatformOrder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderShowGovernanceActionsAnchorShouldRenderTest 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_platform_order_show_page_should_render_governance_actions_anchor(): void
{
$this->loginAsPlatformAdmin();
$merchant = Merchant::query()->firstOrFail();
$plan = Plan::query()->create([
'code' => 'po_show_governance_anchor_plan_01',
'name' => '平台订单详情治理动作锚点测试套餐',
'billing_cycle' => 'monthly',
'price' => 10,
'list_price' => 10,
'status' => 'active',
'sort' => 10,
'published_at' => now(),
]);
$order = PlatformOrder::query()->create([
'merchant_id' => $merchant->id,
'plan_id' => $plan->id,
'order_no' => 'PO_SHOW_GOV_ANCHOR_0001',
'order_type' => 'new_purchase',
'status' => 'pending',
'payment_status' => 'paid',
'plan_name' => $plan->name,
'billing_cycle' => $plan->billing_cycle,
'period_months' => 1,
'quantity' => 1,
'payable_amount' => 10,
'paid_amount' => 10,
'placed_at' => now(),
'paid_at' => now(),
]);
$res = $this->get('/admin/platform-orders/' . $order->id);
$res->assertOk();
// Guardrails仪表盘扫描行将“同步无/BMPA无”直达此锚点必须稳定存在。
$res->assertSee('id="order-governance-actions"', false);
}
}