[5.3] Add tests for non-positive arguments in query builder pagination #16359
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.
Follow-up to #16337. Intends to prevent unexpected regressions in the future, e.g. when implementing skip/take for chunk (#9681 - laravel/ideas#103).
Recap:
skip(-1)
sets the property to 0take(-1)
avoids setting the propertyforPage(2, -15)
(2nd argument negative) doesn't workNotes:
chunk(0, ...)
, a "no results" sql query is run (limit 0). This query could be avoided, though I think it's not a big issue. "chunk 0" is an exceptional case and the query is light.forPageAfterId
. All I found is testForPageAfterIdCorrectlyPaginates in DatabaseEloquentIntegrationTest.php.ping :) @jstoone, @arrilot