/**
* @test
*/
public function xxx()
{
$exitCode = Artisan::call('queue:work');
//shell_exec('php artisan queue:work');
}
Run Artisan::call(...)
or shell_exec(...)
in PHPUnit test, it is not working.
/**
* @test
*/
public function xxx()
{
$exitCode = Artisan::call('queue:work');
//shell_exec('php artisan queue:work');
}
Run Artisan::call(...)
or shell_exec(...)
in PHPUnit test, it is not working.
For your unit tests you don't use your normal laravel queue like you do in the rest of your project.
Start your queue using Queue::fake();
and then apply your test logic.
Your tests will push events in this queue and the mock workers will pick up.
Read more about mocking methods here.