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

I believe QueueFake push() method wrong #18832

Closed
lordemanonsr opened this issue Apr 17, 2017 · 2 comments
Closed

I believe QueueFake push() method wrong #18832

lordemanonsr opened this issue Apr 17, 2017 · 2 comments

Comments

@lordemanonsr
Copy link

  • Laravel Version: 5.4.18
  • PHP Version: 7.1.2

Description:

The push() method in QueueFake assumes an object for the $job parameter. It does not accept a string for the job. It then attempts to do a get_class on a string and fails.

As in the require Queue class createPayloadArray method it needs to first determine if $job is an object and only use get_class if it an object and just use the $job value if it is a string.

public function push($job, $data = '', $queue = null)
    {
        $jobName = is_object($job)
            ? get_class($job) 
            : $job;
        
        $this->jobs[$jobName][] = [
            'job' => $job,
            'queue' => $queue,
        ];
    }

@zmay2030
Copy link

zmay2030 commented May 5, 2017

Yeah I see that issue.

Also it seems like you may want to include $data as well

$this->jobs[$jobName][] = [
            'job' => $job,
            'queue' => $queue,
            'data'=>$data
        ];

@themsaid
Copy link
Member

Thanks, opened a PR here #19575

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

3 participants