laravel-actions icon indicating copy to clipboard operation
laravel-actions copied to clipboard

assertPushed() does not seem to work with queue sync

Open davidjr82 opened this issue 2 years ago • 0 comments

Hi!

I have this test assertion in my tests:

SendWelcomeEmail::assertPushed(function (SendWelcomeEmail $job) use ($user) {
    return ($job->user->id === $user->id) && !empty($job->new_password);
});

And I get this error in console when I run them:

Call to undefined method Illuminate\Queue\SyncQueue::pushed()

(...)

  1   ...\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:337
      Illuminate\Queue\QueueManager::__call("pushed")

  2   ...\vendor\lorisleiva\laravel-actions\src\Concerns\AsJob.php:138 
      Illuminate\Support\Facades\Facade::__callStatic("pushed")

Of course, in my testing environment I have the queue env in sync:

phpunit.xml:

<env name="QUEUE_CONNECTION" value="sync"/>

Am I doing something wrong, or is it a bug on the assertion method when working with the sync queue driver and laravel actions?

Thanks!

davidjr82 avatar Mar 31 '22 08:03 davidjr82