So, I'm trying to write a unit test for a piece of code that uses a facade, and it looks like this:
public function test() {
MYFACADE::doSomething();
}
and in the unit test, I am trying to mock the facade call:
MYFACADE::shouldReceive('doSomething')
->once()
->andReturn(false);
The only problem with this is that when Laravel tries to make an instance of underling class for the MYFACADE, it will of course run the constructor, and right there, is hardcoded database connection call. So without changing my facade, and removing database connection from the constructor of the facade class, is there any way to mock facade call without running the constructor of facade ?
Aucun commentaire:
Enregistrer un commentaire