10000 [DI] Cannot replace autowired services for testing purpose · Issue #35176 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[DI] Cannot replace autowired services for testing purpose #35176
Closed
@lucascourot

Description

@lucascourot

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

      0