chore(admin-platform-order): add anchor id for relation subscription governance block

This commit is contained in:
萝卜
2026-03-16 15:15:30 +08:00
parent 3a1a18fc04
commit f0198841a9
2 changed files with 64 additions and 1 deletions

View File

@@ -486,7 +486,7 @@
@endphp
@if($isRenewalMissingSubscription)
<div class="card governance-block mt-10">
<div class="card governance-block mt-10" id="relation-subscription">
<div class="muted text-danger governance-block-title"><strong>订阅关联治理提示</strong></div>
<div class="muted governance-block-body">
<div>

View File

@@ -0,0 +1,63 @@
<?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 AdminPlatformOrderShowRelationSubscriptionBlockShouldHaveAnchorTest 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_show_relation_subscription_block_should_have_anchor_id(): void
{
$this->loginAsPlatformAdmin();
$merchant = Merchant::query()->firstOrFail();
$plan = Plan::query()->create([
'code' => 'po_show_relation_anchor_plan',
'name' => '关联订阅治理锚点测试套餐',
'billing_cycle' => 'monthly',
'price' => 30,
'list_price' => 30,
'status' => 'active',
'sort' => 10,
'published_at' => now(),
]);
$order = PlatformOrder::query()->create([
'merchant_id' => $merchant->id,
'plan_id' => $plan->id,
'order_no' => 'PO_SHOW_RELATION_ANCHOR_0001',
'order_type' => 'renewal',
'status' => 'pending',
'payment_status' => 'unpaid',
'plan_name' => $plan->name,
'billing_cycle' => $plan->billing_cycle,
'period_months' => 1,
'quantity' => 1,
'payable_amount' => 30,
'paid_amount' => 0,
'placed_at' => now(),
'meta' => [],
]);
$res = $this->get('/admin/platform-orders/' . $order->id);
$res->assertOk();
$res->assertSee('id="relation-subscription"', false);
}
}