From 1fa9dacf143ff93b9ab192684cf06bf5f14f0848 Mon Sep 17 00:00:00 2001 From: gabomasi Date: Thu, 7 Dec 2017 10:58:07 -0300 Subject: [PATCH] Back to 7c8d3d04e51cace016474aea8a6ab9a8682f4ab8 + test (#22343) Put the payload column of jobs table to the end of insert statements. --- src/Illuminate/Queue/DatabaseQueue.php | 2 +- tests/Queue/QueueDatabaseQueueUnitTest.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/DatabaseQueue.php b/src/Illuminate/Queue/DatabaseQueue.php index 51a30a7df788..94061e4e0679 100644 --- a/src/Illuminate/Queue/DatabaseQueue.php +++ b/src/Illuminate/Queue/DatabaseQueue.php @@ -171,11 +171,11 @@ protected function buildDatabaseRecord($queue, $payload, $availableAt, $attempts { return [ 'queue' => $queue, - 'payload' => $payload, 'attempts' => $attempts, 'reserved_at' => null, 'available_at' => $availableAt, 'created_at' => $this->currentTime(), + 'payload' => $payload, ]; } diff --git a/tests/Queue/QueueDatabaseQueueUnitTest.php b/tests/Queue/QueueDatabaseQueueUnitTest.php index 3843e578526e..15c271c12954 100644 --- a/tests/Queue/QueueDatabaseQueueUnitTest.php +++ b/tests/Queue/QueueDatabaseQueueUnitTest.php @@ -108,4 +108,12 @@ public function testBulkBatchPushesOntoDatabase() $queue->bulk(['foo', 'bar'], ['data'], 'queue'); } + + public function testBuildDatabaseRecordWithPayloadAtTheEnd() + { + $queue = m::mock('Illuminate\Queue\DatabaseQueue'); + $record = $queue->buildDatabaseRecord('queue','any_payload',0); + $this->assertArrayHasKey('payload', $record); + $this->assertArrayHasKey('payload', array_slice($record, -1, 1, TRUE)); + } }