X-Strike's avatar

How do you test the Job Class?

How do I test all the functionality in the Job Class to make sure it is working correctly? Is it possible to do this while faking the Queue?

I can't use Queue::fake(); because that is just to assert that it is queued or dispatched. It does not execute any methods in the Queue.

For Example:

    /**
     * @test
     */
    public function it_has_successfully_uploaded()
    {        
        $job = new SomeJob(['file' => ['file1.zip']]);

        $job->handle();
    }

When I execute phpunit, I get an error:

Error: Call to a member function getJobId() on null

In the Job class, I have some jobs methods like $this->job->getJobId() and $this->release(5);

0 likes
0 replies

Please or to participate in this conversation.