Skip to content

Fix: Controller Test withBody() - #6843

Merged
MGatner merged 1 commit into
codeigniter4:developfrom
MGatner:controller-test-with-body
Nov 13, 2022
Merged

Fix: Controller Test withBody()#6843
MGatner merged 1 commit into
codeigniter4:developfrom
MGatner:controller-test-with-body

Conversation

@MGatner

@MGatner MGatner commented Nov 12, 2022

Copy link
Copy Markdown
Member

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