[Release] Improvements to the handling of subscriptions with no expiration #132
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
subscribeTo
method inHasSubscriptions
to handle plans without periodicity by explicitly setting expiration tonull
when not provided. This ensures consistent behavior. (src/Models/Concerns/HasSubscriptions.php
, src/Models/Concerns/HasSubscriptions.phpR124-L131)getIsOverdueAttribute
inSubscription
to returnfalse
ifexpired_at
isnull
, preventing overdue status for subscriptions without an expiration date. (src/Models/Subscription.php
, src/Models/Subscription.phpR160-R163)Test coverage enhancements:
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)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)