seed(); $this->post('/admin/login', [ 'email' => 'platform.admin@demo.local', 'password' => 'Platform@123456', ])->assertRedirect('/admin'); } public function test_platform_admin_can_open_platform_order_show_page(): void { $this->loginAsPlatformAdmin(); $merchant = Merchant::query()->firstOrFail(); $plan = Plan::query()->create([ 'code' => 'show_order_test', '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_0001', 'order_type' => 'new_purchase', 'status' => 'pending', 'payment_status' => 'unpaid', 'plan_name' => $plan->name, 'billing_cycle' => $plan->billing_cycle, 'period_months' => 1, 'quantity' => 1, 'payable_amount' => 10, 'paid_amount' => 0, 'placed_at' => now(), 'meta' => [ 'subscription_activation_error' => [ 'message' => 'demo', 'at' => now()->toDateTimeString(), ], 'audit' => [ [ 'action' => 'clear_sync_error', 'scope' => 'filtered', 'at' => now()->toDateTimeString(), 'admin_id' => 1, ], [ 'action' => 'batch_activate_subscription', 'scope' => 'filtered', 'at' => now()->toDateTimeString(), 'admin_id' => 1, ], ], ], ]); $this->get('/admin/platform-orders/' . $order->id) ->assertOk() ->assertSee('平台订单详情') ->assertSee('PO_SHOW_0001') ->assertSee('标记支付并生效') ->assertSee('同步订阅') ->assertSee('订阅同步元数据') ->assertSee('审计记录') ->assertSee('清除同步失败标记'); } public function test_guest_cannot_open_platform_order_show_page(): void { $this->seed(); $merchant = Merchant::query()->firstOrFail(); $plan = Plan::query()->create([ 'code' => 'show_order_test_guest', 'name' => '订单详情测试(guest)', '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_0002', 'order_type' => 'new_purchase', 'status' => 'pending', 'payment_status' => 'unpaid', 'plan_name' => $plan->name, 'billing_cycle' => $plan->billing_cycle, 'period_months' => 1, 'quantity' => 1, 'payable_amount' => 10, 'paid_amount' => 0, 'placed_at' => now(), ]); $this->get('/admin/platform-orders/' . $order->id) ->assertRedirect('/admin/login'); } }