Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[DI] Cannot replace autowired services for testing purpose #35176

Copy link
Copy link
Closed
@lucascourot

Description

@lucascourot
Issue body actions

Symfony version(s) affected: 3.3+

Description
Services used as autowired arguments are not replaced by $container->set() even though they are replaced in the container itself. Thus I found quite a weird behaviour when trying to stub a service for testing purpose.

How to reproduce
Please see the repo I created to reproduce the bug, services are public in test env

Launch phpunit

See the different behaviour in the controller executed by phpunit in the controller test

Additional context
Related feature : #24418

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.