Skip to content

Create stub instead of mock in the getWillReturn method#39

Merged
frankdekker merged 6 commits intomasterfrom
FormAssertion-getWillReturn-should-create-stub
Mar 6, 2026
Merged

Create stub instead of mock in the getWillReturn method#39
frankdekker merged 6 commits intomasterfrom
FormAssertion-getWillReturn-should-create-stub

Conversation

@frankdekker
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings February 15, 2026 19:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Symfony testing helpers so that FormAssertion::getWillReturn() returns a test double intended to behave like a stub for child forms, and adjusts AbstractControllerTestCase::expectCreateForm() to match the new FormAssertion constructor.

Changes:

  • Replaced MockBuilder usage in FormAssertion::getWillReturn() with a MockObject\Generator\Generator::testDouble()-based test double.
  • Removed the TestCase dependency from FormAssertion and updated expectCreateForm() accordingly.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/Symfony/Helper/FormAssertion.php Switches child-form creation in getWillReturn() to a generated test double and drops the stored TestCase.
src/Symfony/AbstractControllerTestCase.php Updates FormAssertion instantiation to match the new constructor signature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Symfony/Helper/FormAssertion.php
Comment thread src/Symfony/Helper/FormAssertion.php Outdated
Comment thread src/Symfony/Helper/FormAssertion.php Outdated
@frankdekker frankdekker requested a review from bram123 February 15, 2026 20:24
@frankdekker frankdekker merged commit d7daefe into master Mar 6, 2026
24 checks passed
@frankdekker frankdekker deleted the FormAssertion-getWillReturn-should-create-stub branch March 6, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants