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.2] Add chunkById query builder tests #12906

Merged

Conversation

kevindoole
Copy link
Contributor

This just adds a test for query builder chunkById, and fixes up some crappy docblocks from my last pr.

There were no existing tests for the query builder chunk method -- possibly because the method is essentially duped from the eloquent builder file. Seems nice to have both sides tested.

Happy to add a couple more tests if they bring any value.

@@ -330,8 +330,8 @@ public function value($column)
/**
* Chunk the results of the query.
*
* @param int $count
* @param callable $callback
* @param int $count
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll get hit on the fingers for these! 😱

The formats are @param__type__$variable (2/2 spaces) and @return_type (1 space).
Always the same number of spaces, no vertical alignment.

@kevindoole
Copy link
Contributor Author

Ha... whoops. I started that way, but then realized that other methods in the file seemed to vertically align, so i changed it. Changed it back now 😄

Thanks for clarifying.

@vlakoff
Copy link
Contributor

vlakoff commented Mar 29, 2016

Some phpdocs don't follow this convention simply because they haven't been updated. It's not supported by StyleCI ;)

@mark86092
Copy link
Contributor

IMO, other part of phpdocs fix should go to new PR

@@ -332,7 +332,7 @@ public function value($column)
*
* @param int $count
* @param callable $callback
* @return bool
* @return bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote @return_type, one space!

(also you may want to stash the commits to not clutter git history)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't worry about phpdoc cs - as long a it's valid phpdoc, taylor or I can clean it up after merge

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do squash this to one commit though.

@GrahamCampbell GrahamCampbell changed the title Add chunkById query builder tests [5.2] Add chunkById query builder tests Mar 29, 2016
@vlakoff
Copy link
Contributor

vlakoff commented Mar 29, 2016

More important, because of the mocking, these tests failed to detect that the results contain only the id column, as I also noted in #12861 (comment).

@taylorotwell taylorotwell merged commit 6c4d6ec into laravel:5.2 Mar 29, 2016
@vlakoff
Copy link
Contributor

vlakoff commented Mar 29, 2016

No thoughts concerning the "only id column in results" issue? Seems pretty important to me.

@kevindoole
Copy link
Contributor Author

@vlakoff yeah, good point on the id, totally missed that. Easy to fix -- will get it done today.

Re: duplication between query builder and eloquent builder -- yes, the chunk method is also duplicated. It seems it would be relatively easy to remove that duplication if it's not there for a specific reason. If i have time tonight, i'll look into it.

@vlakoff
Copy link
Contributor

vlakoff commented Apr 12, 2016

@kevindoole Any news on this "select only id" stuff? As a reminder, this goes unnoticed because tests mock pageAfterId.

@kevindoole
Copy link
Contributor Author

Yeah, I've been dragging my heels with this! I'll get it done tonight; looks like probably a change to one line, unless I figure out a nicer way to test it.

@kevindoole
Copy link
Contributor Author

@vlakoff Looks like someone beat me to it 👍
I'm gonna still take a quick look at some of the duplication there.

@vlakoff
Copy link
Contributor

vlakoff commented Apr 13, 2016

Looks like someone beat me to it 👍

Yep: #13137

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.

5 participants