Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] Add tests for non-positive arguments in query builder pagination #16359

Merged
merged 2 commits into from
Nov 11, 2016
Merged

[5.3] Add tests for non-positive arguments in query builder pagination #16359

merged 2 commits into from
Nov 11, 2016

Conversation

vlakoff
Copy link
Contributor

@vlakoff vlakoff commented Nov 11, 2016

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 0
  • take(-1) avoids setting the property
  • forPage(2, -15) (2nd argument negative) doesn't work

Notes:

  • With 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.
  • There are no tests for forPageAfterId. All I found is testForPageAfterIdCorrectlyPaginates in DatabaseEloquentIntegrationTest.php.


ping :) @jstoone, @arrilot

@taylorotwell taylorotwell merged commit d43f64b into laravel:5.3 Nov 11, 2016
@taylorotwell
Copy link
Member

Thank you!

@jstoone
Copy link
Contributor

jstoone commented Nov 11, 2016

awesome!

@taylorotwell
Copy link
Member

This broke tests on master. Can you take a look?

@themsaid themsaid mentioned this pull request Nov 11, 2016
@vlakoff
Copy link
Contributor Author

vlakoff commented Nov 12, 2016

Side effect of #16283, merging from 5.3 to master could miss these orderBy in the tests. Already fixed in #16359.

ansidev pushed a commit to safestudio/mizu-core that referenced this pull request Nov 16, 2016
laravel#16359)

* Add tests for skip, take, forPage with arguments <= 0

* Add tests for chunk with count zero
@vlakoff vlakoff deleted the db-testing branch November 19, 2016 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants