title: How to test Laravel 5 jobs?
body: <p>I try to catch an event, when job is completed</p>
  
  <p>Test code:</p>
  
  <pre><code>class MyTest extends TestCase {
  
     public function testJobsEvents ()
     {
             Queue::after(function (JobProcessed $event) {
                 // if ( $job is 'MyJob1' ) then do test
                 dump($event-&gt;job-&gt;payload());
                 $event-&gt;job-&gt;payload()
             });
             $response = $this-&gt;post('/api/user', [ 'test' =&gt; 'data' ], $this-&gt;headers);
             $response-&gt;assertSuccessful($response-&gt;isOk());
  
     }
  
  }
  </code></pre>
  
  <p>method in <strong>UserController</strong>:</p>
  
  <pre><code>public function userAction (Request $request) {
  
      MyJob1::dispatch($request-&gt;toArray());
      MyJob2::dispatch($request-&gt;toArray());
      return response(null, 200);
  }
  </code></pre>
  
  <p>My job:</p>
  
  <pre><code>class Job1 implements ShouldQueue {
      use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  
       public $data = [];
  
       public function __construct($data)
       {
           $this-&gt;data= $data;
       }
  
        public function handle()
        {
            // Process uploaded
        }
  }
  </code></pre>
  
  <p>I need to check some data after job is complete but I get serialized data from 
  <code>$event-&gt;job-&gt;payload()</code> in <code>Queue::after</code> And I don't understand how to check job ?</p>