Skip to content

Conversation

lucasdotvin
Copy link
Owner

This pull request introduces changes to improve subscription handling logic and ensure proper test coverage for edge cases. The most important updates include refining the expiration logic for plans without periodicity, adjusting overdue determination, and adding new test cases to validate these behaviors.

Subscription logic improvements:

  • Updated subscribeTo method in HasSubscriptions to handle plans without periodicity by explicitly setting expiration to null when not provided. This ensures consistent behavior. (src/Models/Concerns/HasSubscriptions.php, src/Models/Concerns/HasSubscriptions.phpR124-L131)
  • Modified getIsOverdueAttribute in Subscription to return false if expired_at is null, preventing overdue status for subscriptions without an expiration date. (src/Models/Subscription.php, src/Models/Subscription.phpR160-R163)

Test coverage enhancements:

  • Added testItUsesReceivedExpirationEvenIfThePlanHasNoPeriodicity to verify that a provided expiration date is respected even when the plan lacks periodicity. (tests/Models/Concerns/HasSubscriptionsTest.php, tests/Models/Concerns/HasSubscriptionsTest.phpR1080-R1094)
  • Introduced testModelDoesNotRegisterOverdueIfThereIsNoExpiration to confirm that subscriptions without an expiration date do not register as overdue during renewal. (tests/Models/SubscriptionTest.php, tests/Models/SubscriptionTest.phpR204-R221)

@lucasdotvin lucasdotvin self-assigned this Jul 22, 2025
@lucasdotvin lucasdotvin added the bug Something isn't working label Jul 22, 2025
@lucasdotvin lucasdotvin merged commit 291b821 into main Jul 22, 2025
44 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant