From 9312017d43a82d26747c3eb93692f9e5254ceba0 Mon Sep 17 00:00:00 2001 From: Ahmed Alaa <92916738+AhmedAlaa4611@users.noreply.github.com> Date: Sat, 11 Oct 2025 17:31:20 +0300 Subject: [PATCH] Expand single-line array into multiline --- tests/Queue/QueueSqsQueueTest.php | 70 ++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 10 deletions(-) diff --git a/tests/Queue/QueueSqsQueueTest.php b/tests/Queue/QueueSqsQueueTest.php index e0b240e09758..77cd89bbc3be 100755 --- a/tests/Queue/QueueSqsQueueTest.php +++ b/tests/Queue/QueueSqsQueueTest.php @@ -327,7 +327,12 @@ public function testPushProperlyPushesJobStringOntoSqsFifoQueue() $queue->setContainer($container = m::spy(Container::class)); $queue->expects($this->once())->method('createPayload')->with($this->mockedJob, $this->fifoQueueName, $this->mockedData)->willReturn($this->mockedPayload); $queue->expects($this->once())->method('getQueue')->with($this->fifoQueueName)->willReturn($this->fifoQueueUrl); - $this->sqs->shouldReceive('sendMessage')->once()->with(['QueueUrl' => $this->fifoQueueUrl, 'MessageBody' => $this->mockedPayload, 'MessageGroupId' => $this->fifoQueueName, 'MessageDeduplicationId' => $this->mockedDeduplicationId])->andReturn($this->mockedSendMessageResponseModel); + $this->sqs->shouldReceive('sendMessage')->once()->with([ + 'QueueUrl' => $this->fifoQueueUrl, + 'MessageBody' => $this->mockedPayload, + 'MessageGroupId' => $this->fifoQueueName, + 'MessageDeduplicationId' => $this->mockedDeduplicationId, + ])->andReturn($this->mockedSendMessageResponseModel); $id = $queue->push($this->mockedJob, $this->mockedData, $this->fifoQueueName); $this->assertEquals($this->mockedMessageId, $id); $container->shouldHaveReceived('bound')->with('events')->twice(); @@ -345,7 +350,12 @@ public function testPushProperlyPushesJobObjectOntoSqsFifoQueue() $queue->setContainer($container = m::spy(Container::class)); $queue->expects($this->once())->method('createPayload')->with($job, $this->fifoQueueName, $this->mockedData)->willReturn($this->mockedPayload); $queue->expects($this->once())->method('getQueue')->with($this->fifoQueueName)->willReturn($this->fifoQueueUrl); - $this->sqs->shouldReceive('sendMessage')->once()->with(['QueueUrl' => $this->fifoQueueUrl, 'MessageBody' => $this->mockedPayload, 'MessageGroupId' => $this->mockedMessageGroupId, 'MessageDeduplicationId' => $this->mockedDeduplicationId])->andReturn($this->mockedSendMessageResponseModel); + $this->sqs->shouldReceive('sendMessage')->once()->with([ + 'QueueUrl' => $this->fifoQueueUrl, + 'MessageBody' => $this->mockedPayload, + 'MessageGroupId' => $this->mockedMessageGroupId, + 'MessageDeduplicationId' => $this->mockedDeduplicationId, + ])->andReturn($this->mockedSendMessageResponseModel); $id = $queue->push($job, $this->mockedData, $this->fifoQueueName); $this->assertEquals($this->mockedMessageId, $id); $container->shouldHaveReceived('bound')->with('events')->twice(); @@ -363,7 +373,12 @@ public function testPushProperlyPushesJobObjectOntoSqsFifoQueueWithDeduplication $queue->setContainer($container = m::spy(Container::class)); $queue->expects($this->once())->method('createPayload')->with($job, $this->fifoQueueName, $this->mockedData)->willReturn($this->mockedPayload); $queue->expects($this->once())->method('getQueue')->with($this->fifoQueueName)->willReturn($this->fifoQueueUrl); - $this->sqs->shouldReceive('sendMessage')->once()->with(['QueueUrl' => $this->fifoQueueUrl, 'MessageBody' => $this->mockedPayload, 'MessageGroupId' => $this->mockedMessageGroupId, 'MessageDeduplicationId' => $this->mockedDeduplicationId])->andReturn($this->mockedSendMessageResponseModel); + $this->sqs->shouldReceive('sendMessage')->once()->with([ + 'QueueUrl' => $this->fifoQueueUrl, + 'MessageBody' => $this->mockedPayload, + 'MessageGroupId' => $this->mockedMessageGroupId, + 'MessageDeduplicationId' => $this->mockedDeduplicationId, + ])->andReturn($this->mockedSendMessageResponseModel); $id = $queue->push($job, $this->mockedData, $this->fifoQueueName); $this->assertEquals($this->mockedMessageId, $id); $container->shouldHaveReceived('bound')->with('events')->twice(); @@ -386,7 +401,12 @@ public function testPushProperlyPushesJobObjectOntoSqsFifoQueueWithDeduplicator( $queue->setContainer($container = m::spy(Container::class)); $queue->expects($this->once())->method('createPayload')->with($job, $this->fifoQueueName, $this->mockedData)->willReturn($this->mockedPayload); $queue->expects($this->once())->method('getQueue')->with($this->fifoQueueName)->willReturn($this->fifoQueueUrl); - $this->sqs->shouldReceive('sendMessage')->once()->with(['QueueUrl' => $this->fifoQueueUrl, 'MessageBody' => $this->mockedPayload, 'MessageGroupId' => $this->mockedMessageGroupId, 'MessageDeduplicationId' => $this->mockedDeduplicationId])->andReturn($this->mockedSendMessageResponseModel); + $this->sqs->shouldReceive('sendMessage')->once()->with([ + 'QueueUrl' => $this->fifoQueueUrl, + 'MessageBody' => $this->mockedPayload, + 'MessageGroupId' => $this->mockedMessageGroupId, + 'MessageDeduplicationId' => $this->mockedDeduplicationId, + ])->andReturn($this->mockedSendMessageResponseModel); $id = $queue->push($job, $this->mockedData, $this->fifoQueueName); $this->assertEquals($this->mockedMessageId, $id); $container->shouldHaveReceived('bound')->with('events')->twice(); @@ -402,7 +422,12 @@ public function testPendingDispatchProperlyPushesJobObjectOntoSqsFifoQueue() $queue->setContainer($container = m::spy(Container::class)); $queue->expects($this->once())->method('createPayload')->with($pendingDispatch->getJob(), $this->fifoQueueName, '')->willReturn($this->mockedPayload); $queue->expects($this->once())->method('getQueue')->with(null)->willReturn($this->fifoQueueUrl); - $this->sqs->shouldReceive('sendMessage')->once()->with(['QueueUrl' => $this->fifoQueueUrl, 'MessageBody' => $this->mockedPayload, 'MessageGroupId' => $this->mockedMessageGroupId, 'MessageDeduplicationId' => $this->mockedDeduplicationId])->andReturn($this->mockedSendMessageResponseModel); + $this->sqs->shouldReceive('sendMessage')->once()->with([ + 'QueueUrl' => $this->fifoQueueUrl, + 'MessageBody' => $this->mockedPayload, + 'MessageGroupId' => $this->mockedMessageGroupId, + 'MessageDeduplicationId' => $this->mockedDeduplicationId, + ])->andReturn($this->mockedSendMessageResponseModel); $dispatcher = new Dispatcher($container, fn () => $queue); app()->instance(DispatcherContract::class, $dispatcher); @@ -425,7 +450,12 @@ public function testPendingDispatchProperlyPushesJobObjectOntoSqsFifoQueueWithDe $queue->setContainer($container = m::spy(Container::class)); $queue->expects($this->once())->method('createPayload')->with($pendingDispatch->getJob(), $this->fifoQueueName, '')->willReturn($this->mockedPayload); $queue->expects($this->once())->method('getQueue')->with(null)->willReturn($this->fifoQueueUrl); - $this->sqs->shouldReceive('sendMessage')->once()->with(['QueueUrl' => $this->fifoQueueUrl, 'MessageBody' => $this->mockedPayload, 'MessageGroupId' => $this->mockedMessageGroupId, 'MessageDeduplicationId' => $this->mockedDeduplicationId])->andReturn($this->mockedSendMessageResponseModel); + $this->sqs->shouldReceive('sendMessage')->once()->with([ + 'QueueUrl' => $this->fifoQueueUrl, + 'MessageBody' => $this->mockedPayload, + 'MessageGroupId' => $this->mockedMessageGroupId, + 'MessageDeduplicationId' => $this->mockedDeduplicationId, + ])->andReturn($this->mockedSendMessageResponseModel); $dispatcher = new Dispatcher($container, fn () => $queue); app()->instance(DispatcherContract::class, $dispatcher); @@ -457,7 +487,12 @@ public function testPendingDispatchProperlyPushesJobObjectOntoSqsFifoQueueWithDe $queue->setContainer($container = m::spy(Container::class)); $queue->expects($this->once())->method('createPayload')->with($pendingDispatch->getJob(), $this->fifoQueueName, '')->willReturn($this->mockedPayload); $queue->expects($this->once())->method('getQueue')->with(null)->willReturn($this->fifoQueueUrl); - $this->sqs->shouldReceive('sendMessage')->once()->with(['QueueUrl' => $this->fifoQueueUrl, 'MessageBody' => $this->mockedPayload, 'MessageGroupId' => $this->mockedMessageGroupId, 'MessageDeduplicationId' => $this->mockedDeduplicationId])->andReturn($this->mockedSendMessageResponseModel); + $this->sqs->shouldReceive('sendMessage')->once()->with([ + 'QueueUrl' => $this->fifoQueueUrl, + 'MessageBody' => $this->mockedPayload, + 'MessageGroupId' => $this->mockedMessageGroupId, + 'MessageDeduplicationId' => $this->mockedDeduplicationId, + ])->andReturn($this->mockedSendMessageResponseModel); $dispatcher = new Dispatcher($container, fn () => $queue); app()->instance(DispatcherContract::class, $dispatcher); @@ -515,7 +550,12 @@ public function testDelayedPushProperlyPushesJobStringOntoSqsFifoQueueWithoutDel $queue->expects($this->once())->method('createPayload')->with($this->mockedJob, $this->fifoQueueName, $this->mockedData)->willReturn($this->mockedPayload); $queue->expects($this->never())->method('secondsUntil')->with($this->mockedDelay)->willReturn($this->mockedDelay); $queue->expects($this->once())->method('getQueue')->with($this->fifoQueueName)->willReturn($this->fifoQueueUrl); - $this->sqs->shouldReceive('sendMessage')->once()->with(['QueueUrl' => $this->fifoQueueUrl, 'MessageBody' => $this->mockedPayload, 'MessageGroupId' => $this->fifoQueueName, 'MessageDeduplicationId' => $this->mockedDeduplicationId])->andReturn($this->mockedSendMessageResponseModel); + $this->sqs->shouldReceive('sendMessage')->once()->with([ + 'QueueUrl' => $this->fifoQueueUrl, + 'MessageBody' => $this->mockedPayload, + 'MessageGroupId' => $this->fifoQueueName, + 'MessageDeduplicationId' => $this->mockedDeduplicationId, + ])->andReturn($this->mockedSendMessageResponseModel); $id = $queue->later($this->mockedDelay, $this->mockedJob, $this->mockedData, $this->fifoQueueName); $this->assertEquals($this->mockedMessageId, $id); $container->shouldHaveReceived('bound')->with('events')->twice(); @@ -534,7 +574,12 @@ public function testDelayedPushProperlyPushesJobObjectOntoSqsFifoQueueWithoutDel $queue->expects($this->once())->method('createPayload')->with($job, $this->fifoQueueName, $this->mockedData)->willReturn($this->mockedPayload); $queue->expects($this->never())->method('secondsUntil')->with($this->mockedDelay)->willReturn($this->mockedDelay); $queue->expects($this->once())->method('getQueue')->with($this->fifoQueueName)->willReturn($this->fifoQueueUrl); - $this->sqs->shouldReceive('sendMessage')->once()->with(['QueueUrl' => $this->fifoQueueUrl, 'MessageBody' => $this->mockedPayload, 'MessageGroupId' => $this->mockedMessageGroupId, 'MessageDeduplicationId' => $this->mockedDeduplicationId])->andReturn($this->mockedSendMessageResponseModel); + $this->sqs->shouldReceive('sendMessage')->once()->with([ + 'QueueUrl' => $this->fifoQueueUrl, + 'MessageBody' => $this->mockedPayload, + 'MessageGroupId' => $this->mockedMessageGroupId, + 'MessageDeduplicationId' => $this->mockedDeduplicationId, + ])->andReturn($this->mockedSendMessageResponseModel); $id = $queue->later($this->mockedDelay, $job, $this->mockedData, $this->fifoQueueName); $this->assertEquals($this->mockedMessageId, $id); $container->shouldHaveReceived('bound')->with('events')->twice(); @@ -552,7 +597,12 @@ public function testDelayedPendingDispatchProperlyPushesJobObjectOntoSqsFifoQueu $queue->setContainer($container = m::spy(Container::class)); $queue->expects($this->once())->method('createPayload')->with($pendingDispatch->getJob(), $this->fifoQueueName, '')->willReturn($this->mockedPayload); $queue->expects($this->once())->method('getQueue')->with(null)->willReturn($this->fifoQueueUrl); - $this->sqs->shouldReceive('sendMessage')->once()->with(['QueueUrl' => $this->fifoQueueUrl, 'MessageBody' => $this->mockedPayload, 'MessageGroupId' => $this->mockedMessageGroupId, 'MessageDeduplicationId' => $this->mockedDeduplicationId])->andReturn($this->mockedSendMessageResponseModel); + $this->sqs->shouldReceive('sendMessage')->once()->with([ + 'QueueUrl' => $this->fifoQueueUrl, + 'MessageBody' => $this->mockedPayload, + 'MessageGroupId' => $this->mockedMessageGroupId, + 'MessageDeduplicationId' => $this->mockedDeduplicationId, + ])->andReturn($this->mockedSendMessageResponseModel); $dispatcher = new Dispatcher($container, fn () => $queue); app()->instance(DispatcherContract::class, $dispatcher);