From 37ef934e4008f0ecc5998c8be566780b9238ec13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Wed, 18 Mar 2026 07:41:23 +0800 Subject: [PATCH] Platform order show: add subscription sync anchor with guardrail --- .../admin/platform_orders/show.blade.php | 2 +- ...SubscriptionSyncAnchorShouldRenderTest.php | 73 +++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/AdminPlatformOrderShowSubscriptionSyncAnchorShouldRenderTest.php diff --git a/resources/views/admin/platform_orders/show.blade.php b/resources/views/admin/platform_orders/show.blade.php index a0a8e6a..982db79 100644 --- a/resources/views/admin/platform_orders/show.blade.php +++ b/resources/views/admin/platform_orders/show.blade.php @@ -754,7 +754,7 @@ -
+

订阅同步记录

@if($activation) diff --git a/tests/Feature/AdminPlatformOrderShowSubscriptionSyncAnchorShouldRenderTest.php b/tests/Feature/AdminPlatformOrderShowSubscriptionSyncAnchorShouldRenderTest.php new file mode 100644 index 0000000..fb1e01b --- /dev/null +++ b/tests/Feature/AdminPlatformOrderShowSubscriptionSyncAnchorShouldRenderTest.php @@ -0,0 +1,73 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_platform_order_show_page_should_render_subscription_sync_anchor(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + + $plan = Plan::query()->create([ + 'code' => 'plan_sync_anchor_0001', + '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_SYNC_ANCHOR_0001', + 'order_type' => 'new_purchase', + 'status' => 'activated', + '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()->subMinutes(10), + 'paid_at' => now()->subMinutes(9), + 'activated_at' => now()->subMinutes(8), + 'meta' => [ + 'subscription_activation' => [ + 'subscription_id' => 123, + 'synced_at' => now()->toDateTimeString(), + 'admin_id' => 1, + ], + ], + ]); + + $html = $this->get('/admin/platform-orders/' . $order->id) + ->assertOk() + ->getContent(); + + $this->assertStringContainsString('id="subscription-sync"', $html); + } +}