test(billing): assert renewal SOP extends subscription ends_at

This commit is contained in:
萝卜
2026-03-17 12:24:48 +08:00
parent 2fafec5abd
commit 81e3189885

View File

@@ -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));
}
}