From 07b6a1b5be139a1ae1edd5b5747b84b8bbd6d813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Niedzielski?= Date: Fri, 7 Jun 2019 02:32:02 +0200 Subject: [PATCH] Fix Code Style in all files --- pkg/amqp-lib/Tests/AmqpProducerTest.php | 16 +-- pkg/dbal/DbalConsumer.php | 4 +- pkg/dbal/DbalMessage.php | 2 +- pkg/dbal/Tests/DbalConsumerTest.php | 10 +- .../Tests/DbalSubscriptionConsumerTest.php | 2 +- .../DoctrineClearIdentityMapExtensionTest.php | 2 +- .../DoctrinePingConnectionExtensionTest.php | 20 ++-- pkg/enqueue/Client/Message.php | 4 +- .../Consumption/Context/MessageResult.php | 2 +- .../Tests/Client/DelegateProcessorTest.php | 4 +- .../Extension/PrepareBodyExtensionTest.php | 2 +- .../FallbackSubscriptionConsumerTest.php | 4 +- .../CalculateRootJobStatusProcessorTest.php | 6 +- .../CalculateRootJobStatusServiceTest.php | 40 +++---- .../Tests/DependentJobProcessorTest.php | 20 ++-- .../Tests/DependentJobServiceTest.php | 4 +- .../Tests/Doctrine/JobStorageTest.php | 108 +++++++++--------- pkg/job-queue/Tests/JobProcessorTest.php | 40 +++---- pkg/job-queue/Tests/JobRunnerTest.php | 46 ++++---- pkg/mongodb/Tests/MongodbConsumerTest.php | 2 +- .../Tests/MongodbSubscriptionConsumerTest.php | 2 +- .../Tests/RedisSubscriptionConsumerTest.php | 2 +- pkg/redis/Tests/Spec/JsonSerializerTest.php | 2 +- pkg/sns/Tests/SnsProducerTest.php | 6 +- pkg/sqs/Tests/SqsProducerTest.php | 8 +- pkg/wamp/Tests/Spec/JsonSerializerTest.php | 2 +- 26 files changed, 180 insertions(+), 180 deletions(-) diff --git a/pkg/amqp-lib/Tests/AmqpProducerTest.php b/pkg/amqp-lib/Tests/AmqpProducerTest.php index 44c68b757..59fc82155 100644 --- a/pkg/amqp-lib/Tests/AmqpProducerTest.php +++ b/pkg/amqp-lib/Tests/AmqpProducerTest.php @@ -61,9 +61,9 @@ public function testShouldPublishMessageToTopic() ->expects($this->once()) ->method('basic_publish') ->with($this->isInstanceOf(LibAMQPMessage::class), 'topic', 'routing-key') - ->will($this->returnCallback(function (LibAMQPMessage $message) use (&$amqpMessage) { + ->willReturnCallback(function (LibAMQPMessage $message) use (&$amqpMessage) { $amqpMessage = $message; - })) + }) ; $topic = new AmqpTopic('topic'); @@ -86,9 +86,9 @@ public function testShouldPublishMessageToQueue() ->expects($this->once()) ->method('basic_publish') ->with($this->isInstanceOf(LibAMQPMessage::class), $this->isEmpty(), 'queue') - ->will($this->returnCallback(function (LibAMQPMessage $message) use (&$amqpMessage) { + ->willReturnCallback(function (LibAMQPMessage $message) use (&$amqpMessage) { $amqpMessage = $message; - })) + }) ; $queue = new AmqpQueue('queue'); @@ -107,9 +107,9 @@ public function testShouldSetMessageHeaders() $channel ->expects($this->once()) ->method('basic_publish') - ->will($this->returnCallback(function (LibAMQPMessage $message) use (&$amqpMessage) { + ->willReturnCallback(function (LibAMQPMessage $message) use (&$amqpMessage) { $amqpMessage = $message; - })) + }) ; $producer = new AmqpProducer($channel, $this->createContextMock()); @@ -126,9 +126,9 @@ public function testShouldSetMessageProperties() $channel ->expects($this->once()) ->method('basic_publish') - ->will($this->returnCallback(function (LibAMQPMessage $message) use (&$amqpMessage) { + ->willReturnCallback(function (LibAMQPMessage $message) use (&$amqpMessage) { $amqpMessage = $message; - })) + }) ; $producer = new AmqpProducer($channel, $this->createContextMock()); diff --git a/pkg/dbal/DbalConsumer.php b/pkg/dbal/DbalConsumer.php index 9d99d5a58..98d348996 100644 --- a/pkg/dbal/DbalConsumer.php +++ b/pkg/dbal/DbalConsumer.php @@ -13,8 +13,8 @@ class DbalConsumer implements Consumer { - use ConsumerPollingTrait, - DbalConsumerHelperTrait; + use ConsumerPollingTrait; + use DbalConsumerHelperTrait; /** * @var DbalContext diff --git a/pkg/dbal/DbalMessage.php b/pkg/dbal/DbalMessage.php index af62c1079..dc5435b17 100644 --- a/pkg/dbal/DbalMessage.php +++ b/pkg/dbal/DbalMessage.php @@ -49,7 +49,7 @@ class DbalMessage implements Message private $timeToLive; /** - * @var null|string + * @var string|null */ private $deliveryId; diff --git a/pkg/dbal/Tests/DbalConsumerTest.php b/pkg/dbal/Tests/DbalConsumerTest.php index c042c5c86..cca4d2380 100644 --- a/pkg/dbal/Tests/DbalConsumerTest.php +++ b/pkg/dbal/Tests/DbalConsumerTest.php @@ -79,12 +79,12 @@ public function testShouldDeleteMessageOnAcknowledge() $context ->expects($this->once()) ->method('getDbalConnection') - ->will($this->returnValue($dbal)) + ->willReturn($dbal) ; $context ->expects($this->once()) ->method('getTableName') - ->will($this->returnValue('some-table-name')) + ->willReturn('some-table-name') ; $consumer = new DbalConsumer($context, $queue); @@ -150,12 +150,12 @@ public function testShouldDeleteMessageFromQueueOnReject() $context ->expects($this->once()) ->method('getDbalConnection') - ->will($this->returnValue($dbal)) + ->willReturn($dbal) ; $context ->expects($this->once()) ->method('getTableName') - ->will($this->returnValue('some-table-name')) + ->willReturn('some-table-name') ; $consumer = new DbalConsumer($context, $queue); @@ -182,7 +182,7 @@ public function testRejectShouldReSendMessageToSameQueueOnRequeue() $context ->expects($this->once()) ->method('createProducer') - ->will($this->returnValue($producerMock)) + ->willReturn($producerMock) ; $consumer = new DbalConsumer($context, $queue); diff --git a/pkg/dbal/Tests/DbalSubscriptionConsumerTest.php b/pkg/dbal/Tests/DbalSubscriptionConsumerTest.php index 2d3a29d79..2f762c2eb 100644 --- a/pkg/dbal/Tests/DbalSubscriptionConsumerTest.php +++ b/pkg/dbal/Tests/DbalSubscriptionConsumerTest.php @@ -153,7 +153,7 @@ private function createDbalContextMock() } /** - * @param null|mixed $queueName + * @param mixed|null $queueName * * @return Consumer|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrineClearIdentityMapExtensionTest.php b/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrineClearIdentityMapExtensionTest.php index 518b40f2d..db3f28e00 100644 --- a/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrineClearIdentityMapExtensionTest.php +++ b/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrineClearIdentityMapExtensionTest.php @@ -32,7 +32,7 @@ public function testShouldClearIdentityMap() $registry ->expects($this->once()) ->method('getManagers') - ->will($this->returnValue(['manager-name' => $manager])) + ->willReturn(['manager-name' => $manager]) ; $context = $this->createContext(); diff --git a/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrinePingConnectionExtensionTest.php b/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrinePingConnectionExtensionTest.php index d7f16dd57..e38c34d52 100644 --- a/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrinePingConnectionExtensionTest.php +++ b/pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrinePingConnectionExtensionTest.php @@ -26,12 +26,12 @@ public function testShouldNotReconnectIfConnectionIsOK() $connection ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(true)) + ->willReturn(true) ; $connection ->expects($this->once()) ->method('ping') - ->will($this->returnValue(true)) + ->willReturn(true) ; $connection ->expects($this->never()) @@ -52,7 +52,7 @@ public function testShouldNotReconnectIfConnectionIsOK() $registry ->expects($this->once()) ->method('getConnections') - ->will($this->returnValue([$connection])) + ->willReturn([$connection]) ; $extension = new DoctrinePingConnectionExtension($registry); @@ -65,12 +65,12 @@ public function testShouldDoesReconnectIfConnectionFailed() $connection ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(true)) + ->willReturn(true) ; $connection ->expects($this->once()) ->method('ping') - ->will($this->returnValue(false)) + ->willReturn(false) ; $connection ->expects($this->once()) @@ -97,7 +97,7 @@ public function testShouldDoesReconnectIfConnectionFailed() $registry ->expects($this->once()) ->method('getConnections') - ->will($this->returnValue([$connection])) + ->willReturn([$connection]) ; $extension = new DoctrinePingConnectionExtension($registry); @@ -110,7 +110,7 @@ public function testShouldSkipIfConnectionWasNotOpened() $connection1 ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(false)) + ->willReturn(false) ; $connection1 ->expects($this->never()) @@ -122,12 +122,12 @@ public function testShouldSkipIfConnectionWasNotOpened() $connection2 ->expects($this->once()) ->method('isConnected') - ->will($this->returnValue(true)) + ->willReturn(true) ; $connection2 ->expects($this->once()) ->method('ping') - ->will($this->returnValue(true)) + ->willReturn(true) ; $context = $this->createContext(); @@ -140,7 +140,7 @@ public function testShouldSkipIfConnectionWasNotOpened() $registry ->expects($this->once()) ->method('getConnections') - ->will($this->returnValue([$connection1, $connection2])) + ->willReturn([$connection1, $connection2]) ; $extension = new DoctrinePingConnectionExtension($registry); diff --git a/pkg/enqueue/Client/Message.php b/pkg/enqueue/Client/Message.php index 6f1186dcc..b1cc9c27a 100644 --- a/pkg/enqueue/Client/Message.php +++ b/pkg/enqueue/Client/Message.php @@ -88,7 +88,7 @@ public function __construct($body = '', array $properties = [], array $headers = } /** - * @return null|string + * @return string|null */ public function getBody() { @@ -96,7 +96,7 @@ public function getBody() } /** - * @param null|string|int|float|array|\JsonSerializable $body + * @param string|int|float|array|\JsonSerializable|null $body */ public function setBody($body) { diff --git a/pkg/enqueue/Consumption/Context/MessageResult.php b/pkg/enqueue/Consumption/Context/MessageResult.php index 302899c9f..4fa8f7de0 100644 --- a/pkg/enqueue/Consumption/Context/MessageResult.php +++ b/pkg/enqueue/Consumption/Context/MessageResult.php @@ -76,7 +76,7 @@ public function getReceivedAt(): int } /** - * @return Result|null|object|string + * @return Result|object|string|null */ public function getResult() { diff --git a/pkg/enqueue/Tests/Client/DelegateProcessorTest.php b/pkg/enqueue/Tests/Client/DelegateProcessorTest.php index 5ed49d8bc..4fe6bd570 100644 --- a/pkg/enqueue/Tests/Client/DelegateProcessorTest.php +++ b/pkg/enqueue/Tests/Client/DelegateProcessorTest.php @@ -39,7 +39,7 @@ public function testShouldProcessMessage() ->expects($this->once()) ->method('process') ->with($this->identicalTo($message), $this->identicalTo($session)) - ->will($this->returnValue('return-value')) + ->willReturn('return-value') ; $processorRegistry = $this->createProcessorRegistryMock(); @@ -47,7 +47,7 @@ public function testShouldProcessMessage() ->expects($this->once()) ->method('get') ->with('processor-name') - ->will($this->returnValue($processor)) + ->willReturn($processor) ; $processor = new DelegateProcessor($processorRegistry); diff --git a/pkg/enqueue/Tests/Client/Extension/PrepareBodyExtensionTest.php b/pkg/enqueue/Tests/Client/Extension/PrepareBodyExtensionTest.php index 1b385c17a..454034abb 100644 --- a/pkg/enqueue/Tests/Client/Extension/PrepareBodyExtensionTest.php +++ b/pkg/enqueue/Tests/Client/Extension/PrepareBodyExtensionTest.php @@ -31,7 +31,7 @@ public function testCouldConstructedWithoutAnyArguments() * @dataProvider provideMessages * * @param mixed $body - * @param null|mixed $contentType + * @param mixed|null $contentType */ public function testShouldSendStringUnchangedAndAddPlainTextContentTypeIfEmpty( $body, diff --git a/pkg/enqueue/Tests/Consumption/FallbackSubscriptionConsumerTest.php b/pkg/enqueue/Tests/Consumption/FallbackSubscriptionConsumerTest.php index 588237c92..dce6081ef 100644 --- a/pkg/enqueue/Tests/Consumption/FallbackSubscriptionConsumerTest.php +++ b/pkg/enqueue/Tests/Consumption/FallbackSubscriptionConsumerTest.php @@ -227,7 +227,7 @@ public function testShouldConsumeTillTimeoutIsReached() } /** - * @param null|mixed $body + * @param mixed|null $body * * @return InteropMessage|\PHPUnit_Framework_MockObject_MockObject */ @@ -244,7 +244,7 @@ private function createMessageStub($body = null) } /** - * @param null|mixed $queueName + * @param mixed|null $queueName * * @return Consumer|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/pkg/job-queue/Tests/CalculateRootJobStatusProcessorTest.php b/pkg/job-queue/Tests/CalculateRootJobStatusProcessorTest.php index fe260bad9..ff5e97c48 100644 --- a/pkg/job-queue/Tests/CalculateRootJobStatusProcessorTest.php +++ b/pkg/job-queue/Tests/CalculateRootJobStatusProcessorTest.php @@ -103,7 +103,7 @@ public function testShouldCallCalculateJobRootStatusAndACKMessage() ->expects($this->once()) ->method('findJobById') ->with('12345') - ->will($this->returnValue($job)) + ->willReturn($job) ; $logger = $this->createLoggerMock(); @@ -146,7 +146,7 @@ public function testShouldSendRootJobStoppedMessageIfJobHasStopped() ->expects($this->once()) ->method('findJobById') ->with('12345') - ->will($this->returnValue($job)) + ->willReturn($job) ; $logger = $this->createLoggerMock(); @@ -156,7 +156,7 @@ public function testShouldSendRootJobStoppedMessageIfJobHasStopped() ->expects($this->once()) ->method('calculate') ->with($this->identicalTo($job)) - ->will($this->returnValue(true)) + ->willReturn(true) ; $producer = $this->createProducerMock(); diff --git a/pkg/job-queue/Tests/CalculateRootJobStatusServiceTest.php b/pkg/job-queue/Tests/CalculateRootJobStatusServiceTest.php index 01f0d10ce..bf16d81ff 100644 --- a/pkg/job-queue/Tests/CalculateRootJobStatusServiceTest.php +++ b/pkg/job-queue/Tests/CalculateRootJobStatusServiceTest.php @@ -60,9 +60,9 @@ public function testShouldCalculateRootJobStatus() $storage ->expects($this->once()) ->method('saveJob') - ->will($this->returnCallback(function (Job $job, $callback) { + ->willReturnCallback(function (Job $job, $callback) { $callback($job); - })) + }) ; $case = new CalculateRootJobStatusService($storage); @@ -92,9 +92,9 @@ public function testShouldCalculateRootJobStatusAndSetStoppedAtTimeIfGotStopStat $storage ->expects($this->once()) ->method('saveJob') - ->will($this->returnCallback(function (Job $job, $callback) { + ->willReturnCallback(function (Job $job, $callback) { $callback($job); - })) + }) ; $case = new CalculateRootJobStatusService($storage); @@ -120,9 +120,9 @@ public function testShouldSetStoppedAtOnlyIfWasNotSet() $em ->expects($this->once()) ->method('saveJob') - ->will($this->returnCallback(function (Job $job, $callback) { + ->willReturnCallback(function (Job $job, $callback) { $callback($job); - })) + }) ; $case = new CalculateRootJobStatusService($em); @@ -146,9 +146,9 @@ public function testShouldThrowIfInvalidStatus() $storage ->expects($this->once()) ->method('saveJob') - ->will($this->returnCallback(function (Job $job, $callback) { + ->willReturnCallback(function (Job $job, $callback) { $callback($job); - })) + }) ; $case = new CalculateRootJobStatusService($storage); @@ -179,9 +179,9 @@ public function testShouldSetStatusNewIfAllChildAreNew() $storage ->expects($this->once()) ->method('saveJob') - ->will($this->returnCallback(function (Job $job, $callback) { + ->willReturnCallback(function (Job $job, $callback) { $callback($job); - })) + }) ; $case = new CalculateRootJobStatusService($storage); @@ -212,9 +212,9 @@ public function testShouldSetStatusRunningIfAnyOneIsRunning() $storage ->expects($this->once()) ->method('saveJob') - ->will($this->returnCallback(function (Job $job, $callback) { + ->willReturnCallback(function (Job $job, $callback) { $callback($job); - })) + }) ; $case = new CalculateRootJobStatusService($storage); @@ -245,9 +245,9 @@ public function testShouldSetStatusRunningIfThereIsNoRunningButNewAndAnyOfStopSt $storage ->expects($this->once()) ->method('saveJob') - ->will($this->returnCallback(function (Job $job, $callback) { + ->willReturnCallback(function (Job $job, $callback) { $callback($job); - })) + }) ; $case = new CalculateRootJobStatusService($storage); @@ -278,9 +278,9 @@ public function testShouldSetStatusCancelledIfAllIsStopButOneIsCancelled() $storage ->expects($this->once()) ->method('saveJob') - ->will($this->returnCallback(function (Job $job, $callback) { + ->willReturnCallback(function (Job $job, $callback) { $callback($job); - })) + }) ; $case = new CalculateRootJobStatusService($storage); @@ -311,9 +311,9 @@ public function testShouldSetStatusFailedIfThereIsAnyOneIsFailedButIsNotCancelle $storage ->expects($this->once()) ->method('saveJob') - ->will($this->returnCallback(function (Job $job, $callback) { + ->willReturnCallback(function (Job $job, $callback) { $callback($job); - })) + }) ; $case = new CalculateRootJobStatusService($storage); @@ -344,9 +344,9 @@ public function testShouldSetStatusSuccessIfAllAreSuccess() $storage ->expects($this->once()) ->method('saveJob') - ->will($this->returnCallback(function (Job $job, $callback) { + ->willReturnCallback(function (Job $job, $callback) { $callback($job); - })) + }) ; $case = new CalculateRootJobStatusService($storage); diff --git a/pkg/job-queue/Tests/DependentJobProcessorTest.php b/pkg/job-queue/Tests/DependentJobProcessorTest.php index 6ae4163f1..fe0980714 100644 --- a/pkg/job-queue/Tests/DependentJobProcessorTest.php +++ b/pkg/job-queue/Tests/DependentJobProcessorTest.php @@ -84,7 +84,7 @@ public function testShouldLogCriticalAndRejectMessageIfJobIsNotRoot() ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $producer = $this->createProducerMock(); @@ -115,7 +115,7 @@ public function testShouldDoNothingIfDependentJobsAreMissing() ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $producer = $this->createProducerMock(); @@ -151,7 +151,7 @@ public function testShouldLogCriticalAndRejectMessageIfDependentJobTopicIsMissin ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $producer = $this->createProducerMock(); @@ -194,7 +194,7 @@ public function testShouldLogCriticalAndRejectMessageIfDependentJobMessageIsMiss ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $producer = $this->createProducerMock(); @@ -239,7 +239,7 @@ public function testShouldPublishDependentMessage() ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $expectedMessage = null; @@ -248,9 +248,9 @@ public function testShouldPublishDependentMessage() ->expects($this->once()) ->method('sendEvent') ->with('topic-name', $this->isInstanceOf(Message::class)) - ->will($this->returnCallback(function ($topic, Message $message) use (&$expectedMessage) { + ->willReturnCallback(function ($topic, Message $message) use (&$expectedMessage) { $expectedMessage = $message; - })) + }) ; $logger = $this->createLoggerMock(); @@ -287,7 +287,7 @@ public function testShouldPublishDependentMessageWithPriority() ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $expectedMessage = null; @@ -296,9 +296,9 @@ public function testShouldPublishDependentMessageWithPriority() ->expects($this->once()) ->method('sendEvent') ->with('topic-name', $this->isInstanceOf(Message::class)) - ->will($this->returnCallback(function ($topic, Message $message) use (&$expectedMessage) { + ->willReturnCallback(function ($topic, Message $message) use (&$expectedMessage) { $expectedMessage = $message; - })) + }) ; $logger = $this->createLoggerMock(); diff --git a/pkg/job-queue/Tests/DependentJobServiceTest.php b/pkg/job-queue/Tests/DependentJobServiceTest.php index 7469b9fb8..ed0f79519 100644 --- a/pkg/job-queue/Tests/DependentJobServiceTest.php +++ b/pkg/job-queue/Tests/DependentJobServiceTest.php @@ -38,11 +38,11 @@ public function testShouldSaveDependentJobs() $storage ->expects($this->once()) ->method('saveJob') - ->will($this->returnCallback(function (Job $job, $callback) { + ->willReturnCallback(function (Job $job, $callback) { $callback($job); return true; - })) + }) ; $context = new DependentJobContext($job); diff --git a/pkg/job-queue/Tests/Doctrine/JobStorageTest.php b/pkg/job-queue/Tests/Doctrine/JobStorageTest.php index 97fbc750c..8344fd0b6 100644 --- a/pkg/job-queue/Tests/Doctrine/JobStorageTest.php +++ b/pkg/job-queue/Tests/Doctrine/JobStorageTest.php @@ -25,7 +25,7 @@ public function testShouldCreateJobObject() $repository ->expects($this->once()) ->method('getClassName') - ->will($this->returnValue(Job::class)) + ->willReturn(Job::class) ; $em = $this->createEntityManagerMock(); @@ -33,12 +33,12 @@ public function testShouldCreateJobObject() ->expects($this->once()) ->method('getRepository') ->with('entity-class') - ->will($this->returnValue($repository)) + ->willReturn($repository) ; $em ->expects($this->any()) ->method('isOpen') - ->will($this->returnValue(true)) + ->willReturn(true) ; $doctrine = $this->createDoctrineMock(); @@ -46,7 +46,7 @@ public function testShouldCreateJobObject() ->expects($this->once()) ->method('getManagerForClass') ->with('entity-class') - ->will($this->returnValue($em)) + ->willReturn($em) ; $doctrine ->expects($this->never()) @@ -65,7 +65,7 @@ public function testShouldResetManagerAndCreateJobObject() $repository ->expects($this->once()) ->method('getClassName') - ->will($this->returnValue(Job::class)) + ->willReturn(Job::class) ; $em = $this->createEntityManagerMock(); @@ -73,12 +73,12 @@ public function testShouldResetManagerAndCreateJobObject() ->expects($this->once()) ->method('getRepository') ->with('entity-class') - ->will($this->returnValue($repository)) + ->willReturn($repository) ; $em ->expects($this->any()) ->method('isOpen') - ->will($this->returnValue(false)) + ->willReturn(false) ; $doctrine = $this->createDoctrineMock(); @@ -86,12 +86,12 @@ public function testShouldResetManagerAndCreateJobObject() ->expects($this->once()) ->method('getManagerForClass') ->with('entity-class') - ->will($this->returnValue($em)) + ->willReturn($em) ; $doctrine ->expects($this->any()) ->method('resetManager') - ->will($this->returnValue($em)) + ->willReturn($em) ; $storage = new JobStorage($doctrine, 'entity-class', 'unique_table'); @@ -106,7 +106,7 @@ public function testShouldThrowIfGotUnexpectedJobInstance() $repository ->expects($this->once()) ->method('getClassName') - ->will($this->returnValue('expected\class\name')) + ->willReturn('expected\class\name') ; $em = $this->createEntityManagerMock(); @@ -114,12 +114,12 @@ public function testShouldThrowIfGotUnexpectedJobInstance() ->expects($this->once()) ->method('getRepository') ->with('entity-class') - ->will($this->returnValue($repository)) + ->willReturn($repository) ; $em ->expects($this->any()) ->method('isOpen') - ->will($this->returnValue(true)) + ->willReturn(true) ; $doctrine = $this->createDoctrineMock(); @@ -127,7 +127,7 @@ public function testShouldThrowIfGotUnexpectedJobInstance() ->expects($this->once()) ->method('getManagerForClass') ->with('entity-class') - ->will($this->returnValue($em)) + ->willReturn($em) ; $doctrine ->expects($this->never()) @@ -156,7 +156,7 @@ public function testShouldSaveJobWithoutLockIfThereIsNoCallbackAndChildJob() $repository ->expects($this->once()) ->method('getClassName') - ->will($this->returnValue(Job::class)) + ->willReturn(Job::class) ; $em = $this->createEntityManagerMock(); @@ -164,7 +164,7 @@ public function testShouldSaveJobWithoutLockIfThereIsNoCallbackAndChildJob() ->expects($this->once()) ->method('getRepository') ->with('entity-class') - ->will($this->returnValue($repository)) + ->willReturn($repository) ; $em ->expects($this->once()) @@ -182,7 +182,7 @@ public function testShouldSaveJobWithoutLockIfThereIsNoCallbackAndChildJob() $em ->expects($this->any()) ->method('isOpen') - ->will($this->returnValue(true)) + ->willReturn(true) ; $doctrine = $this->createDoctrineMock(); @@ -190,7 +190,7 @@ public function testShouldSaveJobWithoutLockIfThereIsNoCallbackAndChildJob() ->expects($this->once()) ->method('getManagerForClass') ->with('entity-class') - ->will($this->returnValue($em)) + ->willReturn($em) ; $doctrine ->expects($this->never()) @@ -210,7 +210,7 @@ public function testShouldSaveJobWithLockIfWithCallback() $repository ->expects($this->once()) ->method('getClassName') - ->will($this->returnValue(Job::class)) + ->willReturn(Job::class) ; $em = $this->createEntityManagerMock(); @@ -218,7 +218,7 @@ public function testShouldSaveJobWithLockIfWithCallback() ->expects($this->once()) ->method('getRepository') ->with('entity-class') - ->will($this->returnValue($repository)) + ->willReturn($repository) ; $em ->expects($this->never()) @@ -236,7 +236,7 @@ public function testShouldSaveJobWithLockIfWithCallback() $em ->expects($this->any()) ->method('isOpen') - ->will($this->returnValue(true)) + ->willReturn(true) ; $doctrine = $this->createDoctrineMock(); @@ -244,7 +244,7 @@ public function testShouldSaveJobWithLockIfWithCallback() ->expects($this->once()) ->method('getManagerForClass') ->with('entity-class') - ->will($this->returnValue($em)) + ->willReturn($em) ; $doctrine ->expects($this->never()) @@ -267,16 +267,16 @@ public function testShouldCatchUniqueConstraintViolationExceptionAndThrowDuplica $repository ->expects($this->once()) ->method('getClassName') - ->will($this->returnValue(Job::class)) + ->willReturn(Job::class) ; $connection = $this->createConnectionMock(); $connection ->expects($this->once()) ->method('transactional') - ->will($this->returnCallback(function ($callback) use ($connection) { + ->willReturnCallback(function ($callback) use ($connection) { $callback($connection); - })) + }) ; $connection ->expects($this->once()) @@ -289,17 +289,17 @@ public function testShouldCatchUniqueConstraintViolationExceptionAndThrowDuplica ->expects($this->once()) ->method('getRepository') ->with('entity-class') - ->will($this->returnValue($repository)) + ->willReturn($repository) ; $em ->expects($this->once()) ->method('getConnection') - ->will($this->returnValue($connection)) + ->willReturn($connection) ; $em ->expects($this->any()) ->method('isOpen') - ->will($this->returnValue(true)) + ->willReturn(true) ; $doctrine = $this->createDoctrineMock(); @@ -307,7 +307,7 @@ public function testShouldCatchUniqueConstraintViolationExceptionAndThrowDuplica ->expects($this->once()) ->method('getManagerForClass') ->with('entity-class') - ->will($this->returnValue($em)) + ->willReturn($em) ; $doctrine ->expects($this->never()) @@ -329,7 +329,7 @@ public function testShouldThrowIfTryToSaveNewEntityWithLock() $repository ->expects($this->once()) ->method('getClassName') - ->will($this->returnValue(Job::class)) + ->willReturn(Job::class) ; $em = $this->createEntityManagerMock(); @@ -337,12 +337,12 @@ public function testShouldThrowIfTryToSaveNewEntityWithLock() ->expects($this->once()) ->method('getRepository') ->with('entity-class') - ->will($this->returnValue($repository)) + ->willReturn($repository) ; $em ->expects($this->any()) ->method('isOpen') - ->will($this->returnValue(true)) + ->willReturn(true) ; $doctrine = $this->createDoctrineMock(); @@ -350,7 +350,7 @@ public function testShouldThrowIfTryToSaveNewEntityWithLock() ->expects($this->once()) ->method('getManagerForClass') ->with('entity-class') - ->will($this->returnValue($em)) + ->willReturn($em) ; $doctrine ->expects($this->never()) @@ -378,13 +378,13 @@ public function testShouldLockEntityAndPassNewInstanceIntoCallback() $repository ->expects($this->once()) ->method('getClassName') - ->will($this->returnValue(Job::class)) + ->willReturn(Job::class) ; $repository ->expects($this->once()) ->method('find') ->with(12345, LockMode::PESSIMISTIC_WRITE) - ->will($this->returnValue($lockedJob)) + ->willReturn($lockedJob) ; $em = $this->createEntityManagerMock(); @@ -392,19 +392,19 @@ public function testShouldLockEntityAndPassNewInstanceIntoCallback() ->expects($this->once()) ->method('getRepository') ->with('entity-class') - ->will($this->returnValue($repository)) + ->willReturn($repository) ; $em ->expects($this->once()) ->method('transactional') - ->will($this->returnCallback(function ($callback) use ($em) { + ->willReturnCallback(function ($callback) use ($em) { $callback($em); - })) + }) ; $em ->expects($this->any()) ->method('isOpen') - ->will($this->returnValue(true)) + ->willReturn(true) ; $doctrine = $this->createDoctrineMock(); @@ -412,7 +412,7 @@ public function testShouldLockEntityAndPassNewInstanceIntoCallback() ->expects($this->once()) ->method('getManagerForClass') ->with('entity-class') - ->will($this->returnValue($em)) + ->willReturn($em) ; $doctrine ->expects($this->never()) @@ -439,9 +439,9 @@ public function testShouldInsertIntoUniqueTableIfJobIsUniqueAndNew() $connection ->expects($this->once()) ->method('transactional') - ->will($this->returnCallback(function ($callback) use ($connection) { + ->willReturnCallback(function ($callback) use ($connection) { $callback($connection); - })) + }) ; $connection ->expects($this->at(0)) @@ -458,7 +458,7 @@ public function testShouldInsertIntoUniqueTableIfJobIsUniqueAndNew() $repository ->expects($this->once()) ->method('getClassName') - ->will($this->returnValue(Job::class)) + ->willReturn(Job::class) ; $em = $this->createEntityManagerMock(); @@ -466,12 +466,12 @@ public function testShouldInsertIntoUniqueTableIfJobIsUniqueAndNew() ->expects($this->once()) ->method('getRepository') ->with('entity-class') - ->will($this->returnValue($repository)) + ->willReturn($repository) ; $em ->expects($this->once()) ->method('getConnection') - ->will($this->returnValue($connection)) + ->willReturn($connection) ; $em ->expects($this->once()) @@ -484,7 +484,7 @@ public function testShouldInsertIntoUniqueTableIfJobIsUniqueAndNew() $em ->expects($this->any()) ->method('isOpen') - ->will($this->returnValue(true)) + ->willReturn(true) ; $doctrine = $this->createDoctrineMock(); @@ -492,7 +492,7 @@ public function testShouldInsertIntoUniqueTableIfJobIsUniqueAndNew() ->expects($this->once()) ->method('getManagerForClass') ->with('entity-class') - ->will($this->returnValue($em)) + ->willReturn($em) ; $doctrine ->expects($this->never()) @@ -528,12 +528,12 @@ public function testShouldDeleteRecordFromUniqueTableIfJobIsUniqueAndStoppedAtIs $repository ->expects($this->once()) ->method('getClassName') - ->will($this->returnValue(Job::class)) + ->willReturn(Job::class) ; $repository ->expects($this->once()) ->method('find') - ->will($this->returnValue($job)) + ->willReturn($job) ; $em = $this->createEntityManagerMock(); @@ -541,24 +541,24 @@ public function testShouldDeleteRecordFromUniqueTableIfJobIsUniqueAndStoppedAtIs ->expects($this->once()) ->method('getRepository') ->with('entity-class') - ->will($this->returnValue($repository)) + ->willReturn($repository) ; $em ->expects($this->once()) ->method('transactional') - ->will($this->returnCallback(function ($callback) use ($em) { + ->willReturnCallback(function ($callback) use ($em) { $callback($em); - })) + }) ; $em ->expects($this->exactly(2)) ->method('getConnection') - ->will($this->returnValue($connection)) + ->willReturn($connection) ; $em ->expects($this->any()) ->method('isOpen') - ->will($this->returnValue(true)) + ->willReturn(true) ; $doctrine = $this->createDoctrineMock(); @@ -566,7 +566,7 @@ public function testShouldDeleteRecordFromUniqueTableIfJobIsUniqueAndStoppedAtIs ->expects($this->once()) ->method('getManagerForClass') ->with('entity-class') - ->will($this->returnValue($em)) + ->willReturn($em) ; $doctrine ->expects($this->never()) diff --git a/pkg/job-queue/Tests/JobProcessorTest.php b/pkg/job-queue/Tests/JobProcessorTest.php index 5ee8159a1..b91a23a97 100644 --- a/pkg/job-queue/Tests/JobProcessorTest.php +++ b/pkg/job-queue/Tests/JobProcessorTest.php @@ -43,7 +43,7 @@ public function testShouldCreateRootJobAndReturnIt() $storage ->expects($this->once()) ->method('createJob') - ->will($this->returnValue($job)) + ->willReturn($job) ; $storage ->expects($this->once()) @@ -72,7 +72,7 @@ public function testShouldCatchDuplicateJobAndTryToFindJobByOwnerId() $storage ->expects($this->once()) ->method('createJob') - ->will($this->returnValue($job)) + ->willReturn($job) ; $storage ->expects($this->once()) @@ -84,7 +84,7 @@ public function testShouldCatchDuplicateJobAndTryToFindJobByOwnerId() ->expects($this->once()) ->method('findRootJobByOwnerIdAndJobName') ->with('owner-id', 'job-name') - ->will($this->returnValue($job)) + ->willReturn($job) ; $processor = new JobProcessor($storage, $this->createProducerMock()); @@ -121,13 +121,13 @@ public function testCreateChildJobShouldFindAndReturnAlreadyCreatedJob() ->expects($this->once()) ->method('findChildJobByName') ->with('job-name', $this->identicalTo($job)) - ->will($this->returnValue($job)) + ->willReturn($job) ; $storage ->expects($this->once()) ->method('findJobById') ->with(123) - ->will($this->returnValue($job)) + ->willReturn($job) ; $processor = new JobProcessor($storage, $this->createProducerMock()); @@ -146,7 +146,7 @@ public function testCreateChildJobShouldCreateAndSaveJobAndPublishRecalculateRoo $storage ->expects($this->once()) ->method('createJob') - ->will($this->returnValue($job)) + ->willReturn($job) ; $storage ->expects($this->once()) @@ -157,13 +157,13 @@ public function testCreateChildJobShouldCreateAndSaveJobAndPublishRecalculateRoo ->expects($this->once()) ->method('findChildJobByName') ->with('job-name', $this->identicalTo($job)) - ->will($this->returnValue(null)) + ->willReturn(null) ; $storage ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $producer = $this->createProducerMock(); @@ -210,7 +210,7 @@ public function testStartChildJobShouldThrowIfJobHasNotNewStatus() ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $processor = new JobProcessor($storage, $this->createProducerMock()); @@ -240,7 +240,7 @@ public function testStartJobShouldUpdateJobWithRunningStatusAndStartAtTime() ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $producer = $this->createProducerMock(); @@ -280,7 +280,7 @@ public function testSuccessChildJobShouldThrowIfJobHasNotRunningStatus() ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $processor = new JobProcessor($storage, $this->createProducerMock()); @@ -310,7 +310,7 @@ public function testSuccessJobShouldUpdateJobWithSuccessStatusAndStopAtTime() ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $producer = $this->createProducerMock(); @@ -350,7 +350,7 @@ public function testFailChildJobShouldThrowIfJobHasNotRunningStatus() ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $processor = new JobProcessor($storage, $this->createProducerMock()); @@ -380,7 +380,7 @@ public function testFailJobShouldUpdateJobWithFailStatusAndStopAtTime() ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $producer = $this->createProducerMock(); @@ -420,7 +420,7 @@ public function testCancelChildJobShouldThrowIfJobHasNotNewOrRunningStatus() ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $processor = new JobProcessor($storage, $this->createProducerMock()); @@ -450,7 +450,7 @@ public function testCancelJobShouldUpdateJobWithCancelStatusAndStoppedAtTimeAndS ->expects($this->once()) ->method('findJobById') ->with(12345) - ->will($this->returnValue($job)) + ->willReturn($job) ; $producer = $this->createProducerMock(); @@ -505,9 +505,9 @@ public function testInterruptRootJobShouldUpdateJobAndSetInterruptedTrue() $storage ->expects($this->once()) ->method('saveJob') - ->will($this->returnCallback(function (Job $job, $callback) { + ->willReturnCallback(function (Job $job, $callback) { $callback($job); - })) + }) ; $processor = new JobProcessor($storage, $this->createProducerMock()); @@ -526,9 +526,9 @@ public function testInterruptRootJobShouldUpdateJobAndSetInterruptedTrueAndStopp $storage ->expects($this->once()) ->method('saveJob') - ->will($this->returnCallback(function (Job $job, $callback) { + ->willReturnCallback(function (Job $job, $callback) { $callback($job); - })) + }) ; $processor = new JobProcessor($storage, $this->createProducerMock()); diff --git a/pkg/job-queue/Tests/JobRunnerTest.php b/pkg/job-queue/Tests/JobRunnerTest.php index 07961b35f..aa7a7f49e 100644 --- a/pkg/job-queue/Tests/JobRunnerTest.php +++ b/pkg/job-queue/Tests/JobRunnerTest.php @@ -19,13 +19,13 @@ public function testRunUniqueShouldCreateRootAndChildJobAndCallCallback() ->expects($this->once()) ->method('findOrCreateRootJob') ->with('owner-id', 'job-name', true) - ->will($this->returnValue($root)) + ->willReturn($root) ; $jobProcessor ->expects($this->once()) ->method('findOrCreateChildJob') ->with('job-name') - ->will($this->returnValue($child)) + ->willReturn($child) ; $expChild = null; @@ -57,12 +57,12 @@ public function testRunUniqueShouldStartChildJobIfNotStarted() $jobProcessor ->expects($this->once()) ->method('findOrCreateRootJob') - ->will($this->returnValue($root)) + ->willReturn($root) ; $jobProcessor ->expects($this->once()) ->method('findOrCreateChildJob') - ->will($this->returnValue($child)) + ->willReturn($child) ; $jobProcessor ->expects($this->once()) @@ -85,12 +85,12 @@ public function testRunUniqueShouldNotStartChildJobIfAlreadyStarted() $jobProcessor ->expects($this->once()) ->method('findOrCreateRootJob') - ->will($this->returnValue($root)) + ->willReturn($root) ; $jobProcessor ->expects($this->once()) ->method('findOrCreateChildJob') - ->will($this->returnValue($child)) + ->willReturn($child) ; $jobProcessor ->expects($this->never()) @@ -111,12 +111,12 @@ public function testRunUniqueShouldSuccessJobIfCallbackReturnValueIsTrue() $jobProcessor ->expects($this->once()) ->method('findOrCreateRootJob') - ->will($this->returnValue($root)) + ->willReturn($root) ; $jobProcessor ->expects($this->once()) ->method('findOrCreateChildJob') - ->will($this->returnValue($child)) + ->willReturn($child) ; $jobProcessor ->expects($this->once()) @@ -142,12 +142,12 @@ public function testRunUniqueShouldFailJobIfCallbackReturnValueIsFalse() $jobProcessor ->expects($this->once()) ->method('findOrCreateRootJob') - ->will($this->returnValue($root)) + ->willReturn($root) ; $jobProcessor ->expects($this->once()) ->method('findOrCreateChildJob') - ->will($this->returnValue($child)) + ->willReturn($child) ; $jobProcessor ->expects($this->never()) @@ -173,12 +173,12 @@ public function testRunUniqueShouldFailJobIfCallbackThrowsException() $jobProcessor ->expects($this->once()) ->method('findOrCreateRootJob') - ->will($this->returnValue($root)) + ->willReturn($root) ; $jobProcessor ->expects($this->once()) ->method('findOrCreateChildJob') - ->will($this->returnValue($child)) + ->willReturn($child) ; $jobProcessor ->expects($this->never()) @@ -205,12 +205,12 @@ public function testRunUniqueShouldThrowOrphanJobExceptionIfChildCleanupFails() $jobProcessor ->expects($this->once()) ->method('findOrCreateRootJob') - ->will($this->returnValue($root)) + ->willReturn($root) ; $jobProcessor ->expects($this->once()) ->method('findOrCreateChildJob') - ->will($this->returnValue($child)) + ->willReturn($child) ; $jobProcessor ->expects($this->never()) @@ -239,12 +239,12 @@ public function testRunUniqueShouldNotSuccessJobIfJobIsAlreadyStopped() $jobProcessor ->expects($this->once()) ->method('findOrCreateRootJob') - ->will($this->returnValue($root)) + ->willReturn($root) ; $jobProcessor ->expects($this->once()) ->method('findOrCreateChildJob') - ->will($this->returnValue($child)) + ->willReturn($child) ; $jobProcessor ->expects($this->never()) @@ -271,7 +271,7 @@ public function testCreateDelayedShouldCreateChildJobAndCallCallback() ->expects($this->once()) ->method('findOrCreateChildJob') ->with('job-name', $this->identicalTo($root)) - ->will($this->returnValue($child)) + ->willReturn($child) ; $expRunner = null; @@ -296,7 +296,7 @@ public function testRunDelayedShouldThrowExceptionIfJobWasNotFoundById() ->expects($this->once()) ->method('findJobById') ->with('job-id') - ->will($this->returnValue(null)) + ->willReturn(null) ; $jobRunner = new JobRunner($jobProcessor); @@ -318,7 +318,7 @@ public function testRunDelayedShouldFindJobAndCallCallback() ->expects($this->once()) ->method('findJobById') ->with('job-id') - ->will($this->returnValue($child)) + ->willReturn($child) ; $expRunner = null; @@ -348,7 +348,7 @@ public function testRunDelayedShouldCancelJobIfRootJobIsInterrupted() ->expects($this->once()) ->method('findJobById') ->with('job-id') - ->will($this->returnValue($child)) + ->willReturn($child) ; $jobProcessor ->expects($this->once()) @@ -373,7 +373,7 @@ public function testRunDelayedShouldSuccessJobIfCallbackReturnValueIsTrue() ->expects($this->once()) ->method('findJobById') ->with('job-id') - ->will($this->returnValue($child)) + ->willReturn($child) ; $jobProcessor ->expects($this->once()) @@ -402,7 +402,7 @@ public function testRunDelayedShouldFailJobIfCallbackReturnValueIsFalse() ->expects($this->once()) ->method('findJobById') ->with('job-id') - ->will($this->returnValue($child)) + ->willReturn($child) ; $jobProcessor ->expects($this->never()) @@ -432,7 +432,7 @@ public function testRunDelayedShouldNotSuccessJobIfAlreadyStopped() ->expects($this->once()) ->method('findJobById') ->with('job-id') - ->will($this->returnValue($child)) + ->willReturn($child) ; $jobProcessor ->expects($this->never()) diff --git a/pkg/mongodb/Tests/MongodbConsumerTest.php b/pkg/mongodb/Tests/MongodbConsumerTest.php index e41681256..b1b98e0cd 100644 --- a/pkg/mongodb/Tests/MongodbConsumerTest.php +++ b/pkg/mongodb/Tests/MongodbConsumerTest.php @@ -104,7 +104,7 @@ public function testRejectShouldReSendMessageToSameQueueOnRequeue() $context ->expects($this->once()) ->method('createProducer') - ->will($this->returnValue($producerMock)) + ->willReturn($producerMock) ; $consumer = new MongodbConsumer($context, $queue); diff --git a/pkg/mongodb/Tests/MongodbSubscriptionConsumerTest.php b/pkg/mongodb/Tests/MongodbSubscriptionConsumerTest.php index 88899c7bb..a7d1d8d8a 100644 --- a/pkg/mongodb/Tests/MongodbSubscriptionConsumerTest.php +++ b/pkg/mongodb/Tests/MongodbSubscriptionConsumerTest.php @@ -153,7 +153,7 @@ private function createMongodbContextMock() } /** - * @param null|mixed $queueName + * @param mixed|null $queueName * * @return Consumer|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/pkg/redis/Tests/RedisSubscriptionConsumerTest.php b/pkg/redis/Tests/RedisSubscriptionConsumerTest.php index 12c377500..3698ad2ea 100644 --- a/pkg/redis/Tests/RedisSubscriptionConsumerTest.php +++ b/pkg/redis/Tests/RedisSubscriptionConsumerTest.php @@ -150,7 +150,7 @@ private function createRedisContextMock() } /** - * @param null|mixed $queueName + * @param mixed|null $queueName * * @return Consumer|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/pkg/redis/Tests/Spec/JsonSerializerTest.php b/pkg/redis/Tests/Spec/JsonSerializerTest.php index fd244b17c..7516090a9 100644 --- a/pkg/redis/Tests/Spec/JsonSerializerTest.php +++ b/pkg/redis/Tests/Spec/JsonSerializerTest.php @@ -40,7 +40,7 @@ public function testThrowIfFailedToEncodeMessageToJson() { $serializer = new JsonSerializer(); - $resource = fopen(__FILE__, 'rb'); + $resource = fopen(__FILE__, 'r'); //guard $this->assertInternalType('resource', $resource); diff --git a/pkg/sns/Tests/SnsProducerTest.php b/pkg/sns/Tests/SnsProducerTest.php index 4850b5c1d..647988b70 100644 --- a/pkg/sns/Tests/SnsProducerTest.php +++ b/pkg/sns/Tests/SnsProducerTest.php @@ -72,7 +72,7 @@ public function testShouldThrowIfPublishFailed() $context ->expects($this->once()) ->method('getSnsClient') - ->will($this->returnValue($client)) + ->willReturn($client) ; $message = new SnsMessage('foo'); @@ -117,7 +117,7 @@ public function testShouldPublish() $context ->expects($this->once()) ->method('getSnsClient') - ->will($this->returnValue($client)) + ->willReturn($client) ; $message = new SnsMessage('theBody', ['key' => 'value'], ['hkey' => 'hvaleu']); @@ -137,7 +137,7 @@ public function testShouldPublishWithMergedAttributes() $context ->expects($this->once()) ->method('getSnsClient') - ->will($this->returnValue($client)); + ->willReturn($client); $expectedArgument = [ 'Message' => 'message', diff --git a/pkg/sqs/Tests/SqsProducerTest.php b/pkg/sqs/Tests/SqsProducerTest.php index a33b98f76..54729adbd 100644 --- a/pkg/sqs/Tests/SqsProducerTest.php +++ b/pkg/sqs/Tests/SqsProducerTest.php @@ -69,7 +69,7 @@ public function testShouldThrowIfSendMessageFailed() $context ->expects($this->once()) ->method('getSqsClient') - ->will($this->returnValue($client)) + ->willReturn($client) ; $destination = new SqsDestination('queue-name'); @@ -116,7 +116,7 @@ public function testShouldSendMessage() $context ->expects($this->once()) ->method('getSqsClient') - ->will($this->returnValue($client)) + ->willReturn($client) ; $destination = new SqsDestination('queue-name'); @@ -160,7 +160,7 @@ public function testShouldSendMessageWithCustomRegion() $context ->expects($this->once()) ->method('getSqsClient') - ->will($this->returnValue($client)) + ->willReturn($client) ; $destination = new SqsDestination('queue-name'); @@ -206,7 +206,7 @@ public function testShouldSendDelayedMessage() $context ->expects($this->once()) ->method('getSqsClient') - ->will($this->returnValue($client)) + ->willReturn($client) ; $destination = new SqsDestination('queue-name'); diff --git a/pkg/wamp/Tests/Spec/JsonSerializerTest.php b/pkg/wamp/Tests/Spec/JsonSerializerTest.php index 4bc49c599..1e7e29413 100644 --- a/pkg/wamp/Tests/Spec/JsonSerializerTest.php +++ b/pkg/wamp/Tests/Spec/JsonSerializerTest.php @@ -40,7 +40,7 @@ public function testThrowIfFailedToEncodeMessageToJson() { $serializer = new JsonSerializer(); - $resource = fopen(__FILE__, 'rb'); + $resource = fopen(__FILE__, 'r'); //guard $this->assertInternalType('resource', $resource);