-
-
Notifications
You must be signed in to change notification settings - Fork 324
Inject on an already created instance #84
Copy link
Copy link
Closed
Labels
Milestone
Description
In tests I've been doing stuff like this
/**
* @return CampaignService
*/
public function getMockedService()
{
return $this->DIContainer->get("CampaignService");
}but I feel it'd be a bit cleaner i think to do something like this
/**
* @return CampaignService
*/
public function getMockedService()
{
$service = new CampaignService()
return $this->DIContainer->InjectOn($service);
}clearly constructor injection couldn't happen in this case...
Reactions are currently unavailable