DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

Why I cannot assert that the job has been dispatched?

Hello may I have some help on that?

I have the following Laravel Controller:

namespace App\Controller
use App\Jobs\MyJob;

class JobDispatchControler
{
   public function callJob(Request $request)
   {
     MyJob::dispatch();
   }
}

The controller above has the following route:

Route::get('/job',"\App\Controller\JobDispatchControler@callJob");

And I want to test whether I a call to the /job will dispatch the MyJob job:

namespace Test\App\MyJob;

use Illuminate\Foundation\Testing\TestCase;

Top comments (0)