[8.x] Create assertSentInOrder to test against the order of Http Requests #35497
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.
This adds a new assertion to the Http client:
Http::assertSentInOrder
which allows you to assert not only that the URLs were sent, but which order they were sent in.Backstory: I was testing a class today that sends a series of API calls in a specific order when things are performing in one way (user doesn't exist, user is created, user is granted access to a resource). I needed to verify that these were being called in a very specific order, and it was a struggle.
I was eventually able to do it like this: https://gist.github.com/anubisthejackle/7388cca61d86c51b759eece64eb7540f
This assertion would have allowed me to simplify my test.