[5.8] Improvements regarding arguments passed to the Gate callbacks #28079
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.
Simplify the arguments passed to the before callbacks
This commit removes some legacy code that was laying around since #12305 was merged.
Before that PR, the arguments were spread out before being passed to the callbacks,
so the user and the ability were merged with the other arguments, before being passed to the callback.
Since then, the arguments are being passed as an array,
so instead of merging the user and the ability with the array of arguments, which is superfluous,
we can directly pass the user, the ability, and the arguments directly to the callback.
This commit doesn't change the existing functionality, and it keeps backwards compatibility.
I have also added some assertions to the tests, since the arguments in the before callbacks were never tested.
Improve tests for arguments in ability checks
Use
assertSame
becauseassertEquals
doesn't compare object references.Add assertions that the arguments are passed to the after callbacks.