Skip to content

fix: mock builder handles traits and enums#2328

Open
Marcus Müller (M-arcus) wants to merge 1 commit into
shopware:mainfrom
M-arcus:patch-3
Open

fix: mock builder handles traits and enums#2328
Marcus Müller (M-arcus) wants to merge 1 commit into
shopware:mainfrom
M-arcus:patch-3

Conversation

@M-arcus

Copy link
Copy Markdown
Contributor

Summary

Test will fail as soon as Enums or Traits are introduced. This PR skips the instancing of them.

Related links

Checklist

  • I reviewed affected links, code samples, and cross-references, including PageRef references where relevant.
  • I added or updated redirects in .gitbook.yaml if pages were moved, renamed, or deleted.
  • I updated .wordlist.txt (and sorted it) if spellcheck flags new legitimate terms.
  • Any required dependent changes in downstream modules have already been merged and published.
  • This pull request is ready for review.

Notes

Copilot AI review requested due to automatic review settings June 14, 2026 11:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the PHPUnit unit testing guide example to avoid attempting to mock PHP types that cannot/shouldn’t be mocked (traits/enums), improving the robustness of the documented sample test.

Changes:

  • Introduces a $className variable with a class-string annotation for clarity.
  • Skips mocking when the discovered symbol is a trait or enum.
  • Simplifies the mock builder call by passing $className directly.

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

Comment on lines +105 to +107
if (trait_exists($className) || enum_exists($className)) {
continue;
}
Comment on lines +105 to +107
if (trait_exists($className) || enum_exists($className)) {
continue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants