test(billing): assert renewal SOP extends subscription ends_at
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user