Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typed property $jobQueue must not be accessed before initialization #299

Open
HugoHeneault opened this issue Dec 5, 2024 · 2 comments
Open

Comments

@HugoHeneault
Copy link

HugoHeneault commented Dec 5, 2024

Hi there,

Loving actions here! And also having a small issues with it:

I have an action dispatching actions on a given queue

<?php
class SomeAction
{
    use AsAction;

    public static function handle(): void
    {
        AnotherAction::dispatch($run)->onQueue(config('queue.jobs.others'));
    }
}

In my tests when I mock then run SomeAction,

it('should not dispatch AnotherAction, function () {
   //   ...
    SomeAction::shouldRun();

It throws:

Typed property AnotherAction::$jobQueue must not be accessed before initialization

With stack trace :

CleanShot 2024-12-05 at 13 29 03

It is possible to mock a Job and use ->onQueue() and it's just returning?

@HugoHeneault
Copy link
Author

Update: it seems ->onQueue has nothing to do with the issue, if I remove it, it stills throws the same error.

@edalzell
Copy link

edalzell commented Dec 8, 2024

the handle method shouldn't be static

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants