From 81e31898856974535b34c0638b48b2529a69e274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Tue, 17 Mar 2026 12:24:48 +0800 Subject: [PATCH] test(billing): assert renewal SOP extends subscription ends_at --- ...BillingClosedLoopRenewalMissingSubscriptionSopTest.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/Feature/AdminBillingClosedLoopRenewalMissingSubscriptionSopTest.php b/tests/Feature/AdminBillingClosedLoopRenewalMissingSubscriptionSopTest.php index 41a68cf..b598f53 100644 --- a/tests/Feature/AdminBillingClosedLoopRenewalMissingSubscriptionSopTest.php +++ b/tests/Feature/AdminBillingClosedLoopRenewalMissingSubscriptionSopTest.php @@ -113,6 +113,9 @@ class AdminBillingClosedLoopRenewalMissingSubscriptionSopTest extends TestCase ])->assertRedirect(); // 4) 再执行 BMPA:应推进订单为 activated,且仍绑定原订阅(不应生成新订阅) + // 同时订阅 ends_at 应被正确延长(续期真正发生)。 + $oldEndsAt = $sub->ends_at->copy(); + $this->post('/admin/platform-orders/' . $order->id . '/mark-paid-and-activate') ->assertRedirect(); @@ -121,9 +124,12 @@ class AdminBillingClosedLoopRenewalMissingSubscriptionSopTest extends TestCase $this->assertSame('activated', (string) $order->status); $this->assertSame($sub->id, (int) $order->site_subscription_id); - // 订阅应仍可用(至少能被正常读取) $sub->refresh(); $this->assertSame($merchant->id, (int) $sub->merchant_id); $this->assertSame($plan->id, (int) $sub->plan_id); + + // 续期断言:新 ends_at 必须大于原 ends_at(按 months=period_months*quantity 续期) + $this->assertNotNull($sub->ends_at); + $this->assertTrue($sub->ends_at->greaterThan($oldEndsAt)); } }