Skip to content

Commit

Permalink
Merge branch '5.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Dec 9, 2017
2 parents c877cb0 + 8ea42ba commit 46bf9c2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
8 changes: 2 additions & 6 deletions src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Queue/SqsQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions tests/Queue/QueueSqsQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public function setUp()
],
]);

$this->mockedReceiveEmptyMessageResponseModel = new Result([
'Messages' => null,
]);

$this->mockedQueueAttributesResponseModel = new Result([
'Attributes' => [
'ApproximateNumberOfMessages' => 1,
Expand All @@ -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();
Expand Down

0 comments on commit 46bf9c2

Please sign in to comment.