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
Add replace argument to IntegrationTestTrait::configRequest #17587
Comments
What if we had a |
This amounts to a wrapper around |
That's fair. Would having a method that does the replacement work instead? Perhaps |
|
Would you say this method should clear the request and then add? Or should it do an array_replace_recursive? |
A recursive replace is likely the most ergonomic solution. It emulates 'merging' without the tedious duplicate values that merging arrays can create. |
Is there a specific reason this is targeted as a 5.1 minor feature. Does Cake strictly put features into minors and fixes into revisions? Only curious. |
Also I briefly looked at doing this, the solution is obvious, the question is what kind of tests would be involved here. There doesn't seem to be tests specifically for configRequest, despite it clearly being covered via its use within tests. |
I'm ok with the implicit testing. If the sample controller method would not generate the correct response if the tokens were present then we have a good integration test that can be documented as to what it covers. |
Description
If I have a common configured request in my
setUp
method such asAnd need to replace it only in a few instances such as:
This adds two bearer tokens because
configRequest()
usesarray_merge_recursive()
. Adding a$replace
bool argument that defaults tofalse
but usesarray_replace_recursive()
if true would be a nice option here rather than having to manually clear the$this->_request
property in these cases.Unless there is another way to accomplish this... and yes I understand this is next level laziness, but this appears to be how it worked in CakePHP 4.
CakePHP Version
5.0
The text was updated successfully, but these errors were encountered: