-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Exclude heading row when limiting imported rows #4217
base: 3.1
Are you sure you want to change the base?
Conversation
453803b
to
fb49cdf
Compare
tests/Concerns/WithLimitTest.php
Outdated
*/ | ||
public function array(array $array) | ||
{ | ||
Assert::assertCount(1, $array); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we test here the exact contents of the array to be sure that it give the right now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous version returned an empty array when the limit was 1, which is why I just tested the length of the array, but I see now that the test could return a false positive in the future if, for example, an array with a single null value was returned instead. I'll change that.
Now that I'm thinking about it, a test with a limit of 2 should probably be added as well. When the limit was 2+, all the rows were imported except the last one, which was imported with null values, as the original issue reported. Currently, the test covers that case too, but it'd be safer to have another test for it.
This bug report has been automatically closed because it has not had recent activity. If this is still an active bug, please comment to reopen. Thank you for your contributions. |
Please take note of our contributing guidelines: https://docs.laravel-excel.com/3.1/getting-started/contributing.html
Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
1️⃣ Why should it be added? What are the benefits of this change?
This fixes #3439, which occurred because the heading row is included in
LimitFilter
by setting 1 as the starting row, which is the heading row when theWithHeadingRow
concern is used.2️⃣ Does it contain multiple, unrelated changes? Please separate the PRs out.
No. The PR only contains 1 commit.
3️⃣ Does it include tests, if possible?
Yes.
4️⃣ Any drawbacks? Possible breaking changes?
Some projects might rely on the current behavior. For example, they might add 1 to their desired limit and ignore the empty row. With this PR, that row could now have data which shouldn't be imported.
5️⃣ Mark the following tasks as done:
6️⃣ Thanks for contributing! 🙌