You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To test any classical services, like Application services / Domain Services, the injection of dependencies is 90% the same :
publicfunctionlet(
FooInterface$foo,
BarInterface$bar,
AInterface$a,
BInterface$b,
XInterface$x,
): void
{
$this->beConstructedWith($foo, $bar, $a, $b, $x); // or ...func_get_args() but could be a bad pratice...
}
What ?
The constructor args should be mocked by their interface easily and quicker than before.
How ?
It could be good to :
create an Attribute like "AutoMockInjection('__construct')" so we could switch from the __construct
read the namespace of each one of the tested object to create the tested instance by injecting mocked interface