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

Fix sorting of multiple responses by status code #623

Merged
merged 3 commits into from
Feb 21, 2023

Conversation

bram-pkg
Copy link
Contributor

The sortBy function from Laravel does not modify the collection's sort order. It returns a new sorted collection.

@shalvah
Copy link
Contributor

shalvah commented Feb 21, 2023

Thanks! Could you add a test for this?

@bram-pkg
Copy link
Contributor Author

Yep, sure thing!

@bram-pkg
Copy link
Contributor Author

bram-pkg commented Feb 21, 2023

@shalvah I've added some unit tests!

I've also had to add ->values() to the call chain, because that resets the internal array keys. Without it, the keys would stay the same, making it so you can't do $responses[0] and actually get the expected 200 response.

@bram-pkg
Copy link
Contributor Author

I've fixed the PHPStan error, my bad. It should be fine now.

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.

2 participants