Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
deguif committed May 17, 2019
1 parent 4811339 commit c8d78f2
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions pkg/sqs/Tests/SqsConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,47 @@ public function testShouldRejectMessageAndRequeue()
$consumer->reject($message, true);
}

public function testShouldRejectMessageAndRequeueWithVisibilityTimeout()
{
$client = $this->createSqsClientMock();
$client
->expects($this->once())
->method('changeMessageVisibility')
->with($this->identicalTo([
'@region' => 'theRegion',
'QueueUrl' => 'theQueueUrl',
'ReceiptHandle' => 'theReceipt',
'VisibilityTimeout' => 30,
]))
;

$context = $this->createContextMock();
$context
->expects($this->once())
->method('getSqsClient')
->willReturn($client)
;
$context
->expects($this->once())
->method('getQueueUrl')
->willReturn('theQueueUrl')
;
$context
->expects($this->never())
->method('createProducer')
;

$message = new SqsMessage();
$message->setReceiptHandle('theReceipt');
$message->setRequeueVisibilityTimeout(30);

$destination = new SqsDestination('queue');
$destination->setRegion('theRegion');

$consumer = new SqsConsumer($context, $destination);
$consumer->reject($message, true);
}

public function testShouldReceiveMessage()
{
$expectedAttributes = [
Expand Down

0 comments on commit c8d78f2

Please sign in to comment.