Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[FrameworkBundle] Fix mocking decorated services in tests#62795

Merged
nicolas-grekas merged 1 commit into
symfony:6.4from
nicolas-grekas:62726
Jan 7, 2026
Merged

[FrameworkBundle] Fix mocking decorated services in tests#62795
nicolas-grekas merged 1 commit into
symfony:6.4from
nicolas-grekas:62726

Conversation

@nicolas-grekas
Copy link
Copy Markdown
Member

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #62693 and #62726
License MIT

The root issue under #62693 was that the innermost decorated service (the original service wrapped by all decorators) was getting inlined into the first decorator during container compilation. When the service is inlined, it no longer exists as a separate service in the container, so TestContainer::set() can't replace it.

@HypeMC
Copy link
Copy Markdown
Member

HypeMC commented Dec 17, 2025

I'm afraid this still doesn't solve the HttpClient problem because the service name is different. For example, before it was my.client and now it's my.client.scoping.

@nicolas-grekas
Copy link
Copy Markdown
Member Author

I figured out the proper fix!

@nicolas-grekas nicolas-grekas merged commit ae9fb0f into symfony:6.4 Jan 7, 2026
11 of 12 checks passed
@nicolas-grekas nicolas-grekas deleted the 62726 branch January 7, 2026 13:50
@siggidiel
Copy link
Copy Markdown

siggidiel commented Jan 19, 2026

Hey guys. Is there going to be a release tag for 7.4.4 soon? We are still waiting for this fix to be released in version 7. I am referring to #62726

@siggidiel
Copy link
Copy Markdown

siggidiel commented Jan 21, 2026

Could you provide some info @nicolas-grekas to me, please? It seems like after the change in 7.4.4 we now have to use my.client.scoping because service-decoration priorities have changed. This does not only apply to tests but also in general. When checking symfony console debug:container | grep client I can see changes in my services. They suddenly have different aliases than before

@xabbuh
Copy link
Copy Markdown
Member

xabbuh commented Jan 21, 2026

Hey guys. Is there going to be a release tag for 7.4.4 soon? We are still waiting for this fix to be released in version 7. I am referring to #62726

Patch releases are usually published at the end of each month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants