-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Closed
Description
- Laravel Version: 9.8.1
- PHP Version: 8.1.2
- Database Driver & Version: sqlite
Description:
The middleware() method on jobs not getting called. Have tried to dd() and it does not work unlike uniqueId() method when implementing the ShouldBeUnique interface.
Steps To Reproduce:
On a clean laravel app,
- Create a job, that simply logs any string
- Inlcude the
middleware()method and include theWithoutOverlappingmiddleware, defining a key for it. - Test it using phpunit or postman making sure to
dd()in the middleware
Below are some screenshots to better explain
Route::get('log', function() {
DB::beginTransaction();
SimpleLogJob::dispatch()->afterCommit()->afterResponse();
User::create([
'email' => 'test@mailinator.com',
'password' => 'unhashedpassword',
'name' => 'Testing Commit',
]);
DB::commit();
return response()->json(['message' => "Logging works."]);
});public function test_job_dispatched_after_response()
{
$response = $this->json('GET', 'api/log');
$response->assertStatus(200)->assertJson([
'message' => 'Logging works.'
]);
$users = User::get();
$this->assertCount(1, $users);
}Should've died and dumped the result some_middleware when the tests run.
Metadata
Metadata
Assignees
Labels
No labels



