DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

Laravel unable to test job with mocked Service and object. The Mockery spy fails to detect called method

Can you help me on this? I try to unit test a Laravel job.

I want to test my functionality of my Job:

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use App\Model\Model;
use App\Services\Service;

class MyJob implements ShouldQueue
{
    use Dispatchable;
    use InteractsWithQueue;
    use Queueable;

    /**
     * Undocumented variable
     *
     * @var User
     */
    private $model;

    public function __construct(Model $model)
    {

Top comments (0)