I have class Name Validator
and it has a method forVote
. This is my code.
public function test_should_set_default()
{
$this->mock = \Mockery::mock(Validator::class);
$this->mock->shouldReceive('forVote')
->andReturnTrue();
$this->app->instance(Validator::class,$this->mock);
$factory = new Factory();
$this->assertTrue($factory->setDefault());
}
So Factory
calls Processor
which calls Validator
. Now I want mock validator to run. But it calls the real method.
What am I doing wrong?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire