Mocking Jobs in laravel 5.2 Unit testing -


i pretty new unit testing. asked write unit test in application. in application have controllers , services. trying mock job called controller this.

$this->expectsjobs(app\jobs\uploadresponseemail::class); 

this throws following error

production.error: mockery\exception\nomatchingexpectationexception: no matching handler found mockery_0_illuminate_bus_dispatcher::dispatch(object(app\jobs\uploadresponseemail)). either method unexpected or arguments matched no expected argument list method

the job has constructor expects argument. think causing error. how can pass constructor argument here. idea ?

you need add mockery composer.json file if using lumen. laravel has default, question lumen not laravel

"mockery/mockery": "0.9.*", 

even laravel 5.1 there: https://github.com/laravel/laravel/blob/5.1/composer.json

where lumen 5.2 missing: https://github.com/laravel/lumen/blob/v5.2.1/composer.json


Comments