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: Controller Test withBody() #6843

Merged
merged 1 commit into from
Nov 13, 2022

Conversation

MGatner
Copy link
Member

@MGatner MGatner commented Nov 12, 2022

Description
The ControllerTestTrait "with___" methods use local property references to apply their changes before execution. This doesn't work for $body however because it is a string and not passed by reference, so using withBody() has no effect.

This PR moves the application of the body to the execute() method so it is properly applied to the request prior to execution.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@MGatner MGatner force-pushed the controller-test-with-body branch from 0b59a7a to 3f5e063 Compare November 12, 2022 23:40
@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Nov 13, 2022
@MGatner MGatner merged commit 5a77d11 into codeigniter4:develop Nov 13, 2022
@MGatner MGatner deleted the controller-test-with-body branch November 13, 2022 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants