- Record refunds immediately before cancellation to prevent retry issues if cancel fails - Wrap Stripe API calls in try-catch for refunds and quantity reverts with internal notifications - Add null check in Team.subscriptionEnded() to prevent NPE when subscription doesn't exist - Fix control flow bug in StripeProcessJob (add missing break statement) - Cap dynamic server limit with MAX_SERVER_LIMIT in subscription updates - Add comprehensive tests for refund failures, event handling, and null safety
16 lines
404 B
PHP
16 lines
404 B
PHP
<?php
|
|
|
|
use App\Models\Team;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
test('subscriptionEnded does not throw when team has no subscription', function () {
|
|
$team = Team::factory()->create();
|
|
|
|
// Should return early without error — no NPE
|
|
$team->subscriptionEnded();
|
|
|
|
// If we reach here, no exception was thrown
|
|
expect(true)->toBeTrue();
|
|
});
|