vendredi 29 janvier 2016

Mocking Jobs in laravel 5.2 Unit testing

I am pretty new to unit testing. I as asked to write unit test in my application. In my application we have controllers and services. I am trying to mock a job called from the controller like this.

$this->expectsJobs(App\Jobs\UploadResponseEmail::class);

This throws the following error

production.ERROR: Mockery\Exception\NoMatchingExpectationException: No matching handler found for Mockery_0_Illuminate_Bus_Dispatcher::dispatch(object(App\Jobs\UploadResponseEmail)). Either the method was unexpected or its arguments matched no expected argument list for this method

the Job has a constructor which expects an argument. I think that is causing error. How can I pass constructor argument here. Any idea ?

Aucun commentaire:

Enregistrer un commentaire