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)); + } }