From c55de5e654d136bc24ca126aca4f5daf87491faa Mon Sep 17 00:00:00 2001 From: Laurence Ioannou Date: Sat, 9 Dec 2017 14:24:58 +0000 Subject: [PATCH 1/2] fix sqs queue for 7.2 (#22374) --- src/Illuminate/Queue/SqsQueue.php | 2 +- tests/Queue/QueueSqsQueueTest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/SqsQueue.php b/src/Illuminate/Queue/SqsQueue.php index 1cf2f9a4b9a0..c8bd3aec3fa5 100755 --- a/src/Illuminate/Queue/SqsQueue.php +++ b/src/Illuminate/Queue/SqsQueue.php @@ -121,7 +121,7 @@ public function pop($queue = null) 'AttributeNames' => ['ApproximateReceiveCount'], ]); - if (count($response['Messages']) > 0) { + if (! is_null($response['Messages']) && count($response['Messages']) > 0) { return new SqsJob( $this->container, $this->sqs, $response['Messages'][0], $this->connectionName, $queue diff --git a/tests/Queue/QueueSqsQueueTest.php b/tests/Queue/QueueSqsQueueTest.php index 63a006d45c63..36637ff47c3d 100755 --- a/tests/Queue/QueueSqsQueueTest.php +++ b/tests/Queue/QueueSqsQueueTest.php @@ -52,6 +52,10 @@ public function setUp() ], ]); + $this->mockedReceiveEmptyMessageResponseModel = new Result([ + 'Messages' => null, + ]); + $this->mockedQueueAttributesResponseModel = new Result([ 'Attributes' => [ 'ApproximateNumberOfMessages' => 1, @@ -69,6 +73,16 @@ public function testPopProperlyPopsJobOffOfSqs() $this->assertInstanceOf('Illuminate\Queue\Jobs\SqsJob', $result); } + public function testPopProperlyHandlesEmptyMessage() + { + $queue = $this->getMockBuilder('Illuminate\Queue\SqsQueue')->setMethods(['getQueue'])->setConstructorArgs([$this->sqs, $this->queueName, $this->account])->getMock(); + $queue->setContainer(m::mock('Illuminate\Container\Container')); + $queue->expects($this->once())->method('getQueue')->with($this->queueName)->will($this->returnValue($this->queueUrl)); + $this->sqs->shouldReceive('receiveMessage')->once()->with(['QueueUrl' => $this->queueUrl, 'AttributeNames' => ['ApproximateReceiveCount']])->andReturn($this->mockedReceiveEmptyMessageResponseModel); + $result = $queue->pop($this->queueName); + $this->assertNull($result); + } + public function testDelayedPushWithDateTimeProperlyPushesJobOntoSqs() { $now = \Illuminate\Support\Carbon::now(); From 8ea42bae95b094133aae92adca926c9fa1180ef3 Mon Sep 17 00:00:00 2001 From: Simon Svensson Date: Sat, 9 Dec 2017 15:25:38 +0100 Subject: [PATCH 2/2] Revert "Operator optional (#22361)" (#22370) This reverts commit 727b8f93703abb2e1ee2443724d233c4e3b14a4f. --- src/Illuminate/Database/Query/Builder.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index 9b2ccbba7f3a..00fc764236e9 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -993,16 +993,12 @@ public function orWhereDate($column, $operator, $value) * * @param string $column * @param string $operator - * @param string $value + * @param int $value * @param string $boolean * @return \Illuminate\Database\Query\Builder|static */ - public function whereTime($column, $operator, $value = null, $boolean = 'and') + public function whereTime($column, $operator, $value, $boolean = 'and') { - list($value, $operator) = $this->prepareValueAndOperator( - $value, $operator, func_num_args() == 2 - ); - return $this->addDateBasedWhere('Time', $column, $operator, $value, $boolean); }