diff --git a/features/fixtures/laravel56/.env b/features/fixtures/laravel56/.env index ec44a125..7e2d4a2a 100644 --- a/features/fixtures/laravel56/.env +++ b/features/fixtures/laravel56/.env @@ -6,18 +6,13 @@ APP_URL=http://localhost LOG_CHANNEL=stack -DB_CONNECTION=mysql -DB_HOST=127.0.0.1 -DB_PORT=3306 -DB_DATABASE=homestead -DB_USERNAME=homestead -DB_PASSWORD=secret +DB_CONNECTION=sqlite BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file SESSION_LIFETIME=120 -QUEUE_DRIVER=sync +QUEUE_DRIVER=database REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null diff --git a/features/fixtures/laravel56/Dockerfile b/features/fixtures/laravel56/Dockerfile index 1f5418c7..614a57a4 100644 --- a/features/fixtures/laravel56/Dockerfile +++ b/features/fixtures/laravel56/Dockerfile @@ -16,4 +16,7 @@ COPY --from=composer:2.2 /usr/bin/composer /usr/local/bin/composer RUN composer install RUN php artisan key:generate +# create database & apply migrations +RUN touch database/database.sqlite && php artisan migrate --no-interaction + CMD php artisan serve --port=8000 --host=0.0.0.0 diff --git a/features/fixtures/laravel56/app/Jobs/HandledJob.php b/features/fixtures/laravel56/app/Jobs/HandledJob.php new file mode 100644 index 00000000..0934b767 --- /dev/null +++ b/features/fixtures/laravel56/app/Jobs/HandledJob.php @@ -0,0 +1,26 @@ +tries = $tries; + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + throw new RuntimeException('uh oh :o'); + } +} diff --git a/features/fixtures/laravel56/database/migrations/2022_12_05_165523_create_jobs_table.php b/features/fixtures/laravel56/database/migrations/2022_12_05_165523_create_jobs_table.php new file mode 100644 index 00000000..58d77154 --- /dev/null +++ b/features/fixtures/laravel56/database/migrations/2022_12_05_165523_create_jobs_table.php @@ -0,0 +1,36 @@ +bigIncrements('id'); + $table->string('queue')->index(); + $table->longText('payload'); + $table->unsignedTinyInteger('attempts'); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('jobs'); + } +} diff --git a/features/fixtures/laravel56/database/migrations/2022_12_05_165527_create_failed_jobs_table.php b/features/fixtures/laravel56/database/migrations/2022_12_05_165527_create_failed_jobs_table.php new file mode 100644 index 00000000..d432dff0 --- /dev/null +++ b/features/fixtures/laravel56/database/migrations/2022_12_05_165527_create_failed_jobs_table.php @@ -0,0 +1,35 @@ +bigIncrements('id'); + $table->text('connection'); + $table->text('queue'); + $table->longText('payload'); + $table->longText('exception'); + $table->timestamp('failed_at')->useCurrent(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('failed_jobs'); + } +} diff --git a/features/fixtures/laravel56/routes/web.php b/features/fixtures/laravel56/routes/web.php index 805ced2f..93537e3f 100644 --- a/features/fixtures/laravel56/routes/web.php +++ b/features/fixtures/laravel56/routes/web.php @@ -11,6 +11,7 @@ | */ +use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; Route::get('/', function () { @@ -52,6 +53,14 @@ Route::view('/handled_view_exception', 'handledexception'); Route::view('/handled_view_error', 'handlederror'); +Route::get('/queue/unhandled', function (Request $request) { + \App\Jobs\UnhandledJob::dispatch((int) $request->query('tries', '1')); +}); + +Route::get('/queue/handled', function (Request $request) { + \App\Jobs\HandledJob::dispatch(); +}); + /** * Return some diagnostics if an OOM did not happen when it should have. * diff --git a/features/queues.feature b/features/queues.feature index 305a3ba5..b09737a1 100644 --- a/features/queues.feature +++ b/features/queues.feature @@ -1,6 +1,6 @@ Feature: Queue support -@not-laravel-latest @not-laravel51 @not-laravel56 @not-lumen8 +@not-laravel-latest @not-laravel51 @not-lumen8 Scenario: Unhandled exceptions are delivered from queues Given I start the laravel fixture And I start the laravel queue worker @@ -21,7 +21,7 @@ Scenario: Unhandled exceptions are delivered from queues And the event "severityReason.type" equals "unhandledExceptionMiddleware" And the event "severityReason.attributes.framework" equals "Laravel" -@not-laravel-latest @not-laravel51 @not-laravel56 @not-lumen8 +@not-laravel-latest @not-laravel51 @not-lumen8 Scenario: Unhandled exceptions are delivered from queued jobs with multiple attmpts Given I start the laravel fixture And I start the laravel queue worker @@ -78,7 +78,7 @@ Scenario: Unhandled exceptions are delivered from queued jobs with multiple attm And the event "severityReason.type" equals "unhandledExceptionMiddleware" And the event "severityReason.attributes.framework" equals "Laravel" -@not-laravel-latest @not-laravel51 @not-laravel56 @not-lumen8 +@not-laravel-latest @not-laravel51 @not-lumen8 Scenario: Handled exceptions are delivered from queues Given I start the laravel fixture And I start the laravel queue worker