From 60894a216bcaccc3c248b20479bb5d96839f11ca Mon Sep 17 00:00:00 2001 From: Norbert Papp Date: Fri, 27 May 2022 08:36:32 +0200 Subject: [PATCH 1/6] refactor(namespaces): renamed \Null to \NullTransport for future compatibility with new PHP versions 'null' is a reserved keyword as of PHP version 7.0 and should not be used to name a class, interface or trait or as part of a namespace (T_NAMESPACE) --- composer.json | 2 +- pkg/null/NullConnectionFactory.php | 2 +- pkg/null/NullConsumer.php | 2 +- pkg/null/NullContext.php | 2 +- pkg/null/NullMessage.php | 2 +- pkg/null/NullProducer.php | 2 +- pkg/null/NullQueue.php | 2 +- pkg/null/NullSubscriptionConsumer.php | 2 +- pkg/null/NullTopic.php | 2 +- pkg/null/Tests/NullConnectionFactoryTest.php | 6 +++--- pkg/null/Tests/NullConsumerTest.php | 8 ++++---- pkg/null/Tests/NullContextTest.php | 16 ++++++++-------- pkg/null/Tests/NullMessageTest.php | 4 ++-- pkg/null/Tests/NullProducerTest.php | 8 ++++---- pkg/null/Tests/NullQueueTest.php | 4 ++-- pkg/null/Tests/NullTopicTest.php | 4 ++-- pkg/null/Tests/Spec/NullMessageTest.php | 4 ++-- pkg/null/composer.json | 2 +- 18 files changed, 37 insertions(+), 37 deletions(-) diff --git a/composer.json b/composer.json index d4aa772c4..ef9cb9844 100644 --- a/composer.json +++ b/composer.json @@ -88,7 +88,7 @@ "Enqueue\\Gps\\": "pkg/gps/", "Enqueue\\JobQueue\\": "pkg/job-queue/", "Enqueue\\Mongodb\\": "pkg/mongodb/", - "Enqueue\\Null\\": "pkg/null/", + "Enqueue\\NullTransporter\\": "pkg/null/", "Enqueue\\Pheanstalk\\": "pkg/pheanstalk/", "Enqueue\\RdKafka\\": "pkg/rdkafka/", "Enqueue\\Redis\\": "pkg/redis/", diff --git a/pkg/null/NullConnectionFactory.php b/pkg/null/NullConnectionFactory.php index b89cd5089..0adff1564 100644 --- a/pkg/null/NullConnectionFactory.php +++ b/pkg/null/NullConnectionFactory.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\Null; +namespace Enqueue\NullTransporter; use Interop\Queue\ConnectionFactory; use Interop\Queue\Context; diff --git a/pkg/null/NullConsumer.php b/pkg/null/NullConsumer.php index d9b234870..3adada348 100644 --- a/pkg/null/NullConsumer.php +++ b/pkg/null/NullConsumer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\Null; +namespace Enqueue\NullTransporter; use Interop\Queue\Consumer; use Interop\Queue\Destination; diff --git a/pkg/null/NullContext.php b/pkg/null/NullContext.php index 5f6001cab..1ab52d6e6 100644 --- a/pkg/null/NullContext.php +++ b/pkg/null/NullContext.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\Null; +namespace Enqueue\NullTransporter; use Interop\Queue\Consumer; use Interop\Queue\Context; diff --git a/pkg/null/NullMessage.php b/pkg/null/NullMessage.php index bd48a387e..8387619a6 100644 --- a/pkg/null/NullMessage.php +++ b/pkg/null/NullMessage.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\Null; +namespace Enqueue\NullTransporter; use Interop\Queue\Message; diff --git a/pkg/null/NullProducer.php b/pkg/null/NullProducer.php index 47235e7f6..97fdb3ef4 100644 --- a/pkg/null/NullProducer.php +++ b/pkg/null/NullProducer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\Null; +namespace Enqueue\NullTransporter; use Interop\Queue\Destination; use Interop\Queue\Message; diff --git a/pkg/null/NullQueue.php b/pkg/null/NullQueue.php index 543111e67..630569110 100644 --- a/pkg/null/NullQueue.php +++ b/pkg/null/NullQueue.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\Null; +namespace Enqueue\NullTransporter; use Interop\Queue\Queue; diff --git a/pkg/null/NullSubscriptionConsumer.php b/pkg/null/NullSubscriptionConsumer.php index 1e9591666..ea7bdf4ed 100644 --- a/pkg/null/NullSubscriptionConsumer.php +++ b/pkg/null/NullSubscriptionConsumer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\Null; +namespace Enqueue\NullTransporter; use Interop\Queue\Consumer; use Interop\Queue\SubscriptionConsumer; diff --git a/pkg/null/NullTopic.php b/pkg/null/NullTopic.php index 9c86ad076..78a837e5b 100644 --- a/pkg/null/NullTopic.php +++ b/pkg/null/NullTopic.php @@ -1,6 +1,6 @@ Date: Fri, 27 May 2022 12:18:06 +0200 Subject: [PATCH 2/6] refactor(namespaces): renamed \Null to \NoEffect for future compatibility with new PHP versions 'null' is a reserved keyword as of PHP version 7.0 and should not be used to name a class, interface or trait or as part of a namespace (T_NAMESPACE) --- composer.json | 2 +- pkg/null/NullConnectionFactory.php | 2 +- pkg/null/NullConsumer.php | 2 +- pkg/null/NullContext.php | 2 +- pkg/null/NullMessage.php | 2 +- pkg/null/NullProducer.php | 2 +- pkg/null/NullQueue.php | 2 +- pkg/null/NullSubscriptionConsumer.php | 2 +- pkg/null/NullTopic.php | 2 +- pkg/null/Tests/NullConnectionFactoryTest.php | 6 +++--- pkg/null/Tests/NullConsumerTest.php | 8 ++++---- pkg/null/Tests/NullContextTest.php | 16 ++++++++-------- pkg/null/Tests/NullMessageTest.php | 4 ++-- pkg/null/Tests/NullProducerTest.php | 8 ++++---- pkg/null/Tests/NullQueueTest.php | 4 ++-- pkg/null/Tests/NullTopicTest.php | 4 ++-- pkg/null/Tests/Spec/NullMessageTest.php | 4 ++-- pkg/null/composer.json | 2 +- 18 files changed, 37 insertions(+), 37 deletions(-) diff --git a/composer.json b/composer.json index ef9cb9844..856f10787 100644 --- a/composer.json +++ b/composer.json @@ -88,7 +88,7 @@ "Enqueue\\Gps\\": "pkg/gps/", "Enqueue\\JobQueue\\": "pkg/job-queue/", "Enqueue\\Mongodb\\": "pkg/mongodb/", - "Enqueue\\NullTransporter\\": "pkg/null/", + "Enqueue\\NoEffect\\\\": "pkg/null/", "Enqueue\\Pheanstalk\\": "pkg/pheanstalk/", "Enqueue\\RdKafka\\": "pkg/rdkafka/", "Enqueue\\Redis\\": "pkg/redis/", diff --git a/pkg/null/NullConnectionFactory.php b/pkg/null/NullConnectionFactory.php index 0adff1564..3060fc18e 100644 --- a/pkg/null/NullConnectionFactory.php +++ b/pkg/null/NullConnectionFactory.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\NullTransporter; +namespace Enqueue\NoEffect; use Interop\Queue\ConnectionFactory; use Interop\Queue\Context; diff --git a/pkg/null/NullConsumer.php b/pkg/null/NullConsumer.php index 3adada348..19f067f9b 100644 --- a/pkg/null/NullConsumer.php +++ b/pkg/null/NullConsumer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\NullTransporter; +namespace Enqueue\NoEffect; use Interop\Queue\Consumer; use Interop\Queue\Destination; diff --git a/pkg/null/NullContext.php b/pkg/null/NullContext.php index 1ab52d6e6..7b42305ec 100644 --- a/pkg/null/NullContext.php +++ b/pkg/null/NullContext.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\NullTransporter; +namespace Enqueue\NoEffect; use Interop\Queue\Consumer; use Interop\Queue\Context; diff --git a/pkg/null/NullMessage.php b/pkg/null/NullMessage.php index 8387619a6..26a439fbf 100644 --- a/pkg/null/NullMessage.php +++ b/pkg/null/NullMessage.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\NullTransporter; +namespace Enqueue\NoEffect; use Interop\Queue\Message; diff --git a/pkg/null/NullProducer.php b/pkg/null/NullProducer.php index 97fdb3ef4..62de43b54 100644 --- a/pkg/null/NullProducer.php +++ b/pkg/null/NullProducer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\NullTransporter; +namespace Enqueue\NoEffect; use Interop\Queue\Destination; use Interop\Queue\Message; diff --git a/pkg/null/NullQueue.php b/pkg/null/NullQueue.php index 630569110..fef315d39 100644 --- a/pkg/null/NullQueue.php +++ b/pkg/null/NullQueue.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\NullTransporter; +namespace Enqueue\NoEffect; use Interop\Queue\Queue; diff --git a/pkg/null/NullSubscriptionConsumer.php b/pkg/null/NullSubscriptionConsumer.php index ea7bdf4ed..bd8896566 100644 --- a/pkg/null/NullSubscriptionConsumer.php +++ b/pkg/null/NullSubscriptionConsumer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\NullTransporter; +namespace Enqueue\NoEffect; use Interop\Queue\Consumer; use Interop\Queue\SubscriptionConsumer; diff --git a/pkg/null/NullTopic.php b/pkg/null/NullTopic.php index 78a837e5b..54351bc8e 100644 --- a/pkg/null/NullTopic.php +++ b/pkg/null/NullTopic.php @@ -1,6 +1,6 @@ Date: Fri, 27 May 2022 12:37:25 +0200 Subject: [PATCH 3/6] refactor(namespaces): renamed \Null to \NoEffect outside pkg/null too 'null' is a reserved keyword as of PHP version 7.0 and should not be used to name a class, interface or trait or as part of a namespace (T_NAMESPACE) --- docs/transport/null.md | 2 +- pkg/amqp-bunny/Tests/AmqpConsumerTest.php | 2 +- pkg/amqp-ext/Tests/AmqpContextTest.php | 8 ++++---- pkg/amqp-lib/Tests/AmqpConsumerTest.php | 2 +- pkg/async-command/Tests/Functional/UseCasesTest.php | 4 ++-- pkg/async-event-dispatcher/Tests/AsyncListenerTest.php | 4 ++-- .../Tests/AsyncProcessorTest.php | 4 ++-- .../Tests/PhpSerializerEventTransformerTest.php | 2 +- .../Tests/Functional/Events/AsyncProcessorTest.php | 4 ++-- pkg/enqueue/Resources.php | 2 +- .../DelayRedeliveredMessageExtensionTest.php | 4 ++-- .../ExclusiveCommandExtensionTest.php | 4 ++-- .../Client/ConsumptionExtension/LogExtensionTest.php | 4 ++-- .../SetRouterPropertiesExtensionTest.php | 4 ++-- pkg/enqueue/Tests/Client/DelegateProcessorTest.php | 2 +- pkg/enqueue/Tests/Client/Driver/GenericDriverTest.php | 6 +++--- pkg/enqueue/Tests/Client/DriverFactoryTest.php | 4 ++-- pkg/enqueue/Tests/Client/RouterProcessorTest.php | 6 +++--- pkg/enqueue/Tests/ConnectionFactoryFactoryTest.php | 2 +- .../Tests/Consumption/CallbackProcessorTest.php | 4 ++-- .../Tests/Consumption/Extension/LogExtensionTest.php | 4 ++-- .../Tests/Consumption/Extension/ReplyExtensionTest.php | 4 ++-- pkg/enqueue/Tests/Consumption/QueueConsumerTest.php | 2 +- pkg/enqueue/Tests/Consumption/ResultTest.php | 2 +- .../Tests/Router/RouteRecipientListProcessorTest.php | 4 ++-- pkg/enqueue/Tests/Rpc/PromiseTest.php | 2 +- pkg/enqueue/Tests/Rpc/RpcClientTest.php | 6 +++--- .../Tests/Symfony/Client/ConsumeCommandTest.php | 2 +- .../Client/Mock/SetupBrokerExtensionCommand.php | 2 +- .../Tests/Symfony/Client/SimpleConsumeCommandTest.php | 2 +- .../Tests/Symfony/Consumption/ConsumeCommandTest.php | 2 +- pkg/fs/Tests/FsContextTest.php | 4 ++-- pkg/fs/Tests/FsProducerTest.php | 8 ++++---- pkg/gearman/Tests/GearmanContextTest.php | 2 +- pkg/gearman/Tests/GearmanProducerTest.php | 10 +++++----- .../Tests/CalculateRootJobStatusProcessorTest.php | 2 +- pkg/job-queue/Tests/DependentJobProcessorTest.php | 2 +- pkg/pheanstalk/Tests/PheanstalkContextTest.php | 2 +- pkg/pheanstalk/Tests/PheanstalkProducerTest.php | 8 ++++---- pkg/rdkafka/Tests/RdKafkaContextTest.php | 2 +- pkg/rdkafka/Tests/RdKafkaProducerTest.php | 10 +++++----- pkg/redis/Tests/RedisContextTest.php | 6 +++--- pkg/redis/Tests/RedisProducerTest.php | 8 ++++---- 43 files changed, 85 insertions(+), 85 deletions(-) diff --git a/docs/transport/null.md b/docs/transport/null.md index aa77b5e72..2b594ffe0 100644 --- a/docs/transport/null.md +++ b/docs/transport/null.md @@ -25,7 +25,7 @@ $ composer require enqueue/null ```php createExtChannelMock()); $this->expectException(InvalidDestinationException::class); - $this->expectExceptionMessage('The destination must be an instance of Interop\Amqp\AmqpQueue but got Enqueue\Null\NullQueue.'); + $this->expectExceptionMessage('The destination must be an instance of Interop\Amqp\AmqpQueue but got Enqueue\NoEffect\NullQueue.'); $context->createConsumer(new NullQueue('aName')); } @@ -133,7 +133,7 @@ public function testShouldThrowIfNotAmqpTopicGivenOnCreateConsumerCall() $context = new AmqpContext($this->createExtChannelMock()); $this->expectException(InvalidDestinationException::class); - $this->expectExceptionMessage('The destination must be an instance of Interop\Amqp\AmqpTopic but got Enqueue\Null\NullTopic.'); + $this->expectExceptionMessage('The destination must be an instance of Interop\Amqp\AmqpTopic but got Enqueue\NoEffect\NullTopic.'); $context->createConsumer(new NullTopic('aName')); } diff --git a/pkg/amqp-lib/Tests/AmqpConsumerTest.php b/pkg/amqp-lib/Tests/AmqpConsumerTest.php index 2bd637d94..57ff5f57a 100644 --- a/pkg/amqp-lib/Tests/AmqpConsumerTest.php +++ b/pkg/amqp-lib/Tests/AmqpConsumerTest.php @@ -4,7 +4,7 @@ use Enqueue\AmqpLib\AmqpConsumer; use Enqueue\AmqpLib\AmqpContext; -use Enqueue\Null\NullMessage; +use Enqueue\NoEffect\NullMessage; use Enqueue\Test\ClassExtensionTrait; use Enqueue\Test\WriteAttributeTrait; use Interop\Amqp\Impl\AmqpMessage; diff --git a/pkg/async-command/Tests/Functional/UseCasesTest.php b/pkg/async-command/Tests/Functional/UseCasesTest.php index 03eb52543..0cd046a4d 100644 --- a/pkg/async-command/Tests/Functional/UseCasesTest.php +++ b/pkg/async-command/Tests/Functional/UseCasesTest.php @@ -6,8 +6,8 @@ use Enqueue\AsyncCommand\RunCommand; use Enqueue\AsyncCommand\RunCommandProcessor; use Enqueue\Consumption\Result; -use Enqueue\Null\NullContext; -use Enqueue\Null\NullMessage; +use Enqueue\NoEffect\NullContext; +use Enqueue\NoEffect\NullMessage; use Interop\Queue\Message; use PHPUnit\Framework\TestCase; diff --git a/pkg/async-event-dispatcher/Tests/AsyncListenerTest.php b/pkg/async-event-dispatcher/Tests/AsyncListenerTest.php index d888c0228..e4c08f5d8 100644 --- a/pkg/async-event-dispatcher/Tests/AsyncListenerTest.php +++ b/pkg/async-event-dispatcher/Tests/AsyncListenerTest.php @@ -5,8 +5,8 @@ use Enqueue\AsyncEventDispatcher\AsyncListener; use Enqueue\AsyncEventDispatcher\EventTransformer; use Enqueue\AsyncEventDispatcher\Registry; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; use Enqueue\Test\ClassExtensionTrait; use Enqueue\Test\ReadAttributeTrait; use Interop\Queue\Context; diff --git a/pkg/async-event-dispatcher/Tests/AsyncProcessorTest.php b/pkg/async-event-dispatcher/Tests/AsyncProcessorTest.php index 7237c9ae2..3ed0c568d 100644 --- a/pkg/async-event-dispatcher/Tests/AsyncProcessorTest.php +++ b/pkg/async-event-dispatcher/Tests/AsyncProcessorTest.php @@ -7,8 +7,8 @@ use Enqueue\AsyncEventDispatcher\EventTransformer; use Enqueue\AsyncEventDispatcher\Registry; use Enqueue\Consumption\Result; -use Enqueue\Null\NullContext; -use Enqueue\Null\NullMessage; +use Enqueue\NoEffect\NullContext; +use Enqueue\NoEffect\NullMessage; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Processor; use PHPUnit\Framework\MockObject\MockObject; diff --git a/pkg/async-event-dispatcher/Tests/PhpSerializerEventTransformerTest.php b/pkg/async-event-dispatcher/Tests/PhpSerializerEventTransformerTest.php index 49f3a9371..83f04db97 100644 --- a/pkg/async-event-dispatcher/Tests/PhpSerializerEventTransformerTest.php +++ b/pkg/async-event-dispatcher/Tests/PhpSerializerEventTransformerTest.php @@ -4,7 +4,7 @@ use Enqueue\AsyncEventDispatcher\EventTransformer; use Enqueue\AsyncEventDispatcher\PhpSerializerEventTransformer; -use Enqueue\Null\NullMessage; +use Enqueue\NoEffect\NullMessage; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Context; use Interop\Queue\Message; diff --git a/pkg/enqueue-bundle/Tests/Functional/Events/AsyncProcessorTest.php b/pkg/enqueue-bundle/Tests/Functional/Events/AsyncProcessorTest.php index d85567509..bbc00b257 100644 --- a/pkg/enqueue-bundle/Tests/Functional/Events/AsyncProcessorTest.php +++ b/pkg/enqueue-bundle/Tests/Functional/Events/AsyncProcessorTest.php @@ -7,8 +7,8 @@ use Enqueue\Bundle\Tests\Functional\App\TestAsyncListener; use Enqueue\Bundle\Tests\Functional\App\TestAsyncSubscriber; use Enqueue\Bundle\Tests\Functional\WebTestCase; -use Enqueue\Null\NullContext; -use Enqueue\Null\NullMessage; +use Enqueue\NoEffect\NullContext; +use Enqueue\NoEffect\NullMessage; use Enqueue\Util\JSON; use Interop\Queue\Processor; use Symfony\Component\EventDispatcher\GenericEvent; diff --git a/pkg/enqueue/Resources.php b/pkg/enqueue/Resources.php index 713450fed..639b918ca 100644 --- a/pkg/enqueue/Resources.php +++ b/pkg/enqueue/Resources.php @@ -10,7 +10,7 @@ use Enqueue\Gearman\GearmanConnectionFactory; use Enqueue\Gps\GpsConnectionFactory; use Enqueue\Mongodb\MongodbConnectionFactory; -use Enqueue\Null\NullConnectionFactory; +use Enqueue\NoEffect\NullConnectionFactory; use Enqueue\Pheanstalk\PheanstalkConnectionFactory; use Enqueue\RdKafka\RdKafkaConnectionFactory; use Enqueue\Redis\RedisConnectionFactory; diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/DelayRedeliveredMessageExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/DelayRedeliveredMessageExtensionTest.php index 0481d27d8..8556b72ab 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/DelayRedeliveredMessageExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/DelayRedeliveredMessageExtensionTest.php @@ -8,8 +8,8 @@ use Enqueue\Client\Message; use Enqueue\Consumption\Context\MessageReceived; use Enqueue\Consumption\Result; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; use Enqueue\Test\TestLogger; use Interop\Queue\Consumer; use Interop\Queue\Context as InteropContext; diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php index dc2c00c96..d084e4c06 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/ExclusiveCommandExtensionTest.php @@ -9,8 +9,8 @@ use Enqueue\Client\RouteCollection; use Enqueue\Consumption\Context\MessageReceived; use Enqueue\Consumption\MessageReceivedExtensionInterface; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Consumer; use Interop\Queue\Context as InteropContext; diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/LogExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/LogExtensionTest.php index 063ea23af..fbd27e5a9 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/LogExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/LogExtensionTest.php @@ -13,8 +13,8 @@ use Enqueue\Consumption\PostMessageReceivedExtensionInterface; use Enqueue\Consumption\Result; use Enqueue\Consumption\StartExtensionInterface; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; use Enqueue\Test\ClassExtensionTrait; use Enqueue\Util\Stringify; use Interop\Queue\Consumer; diff --git a/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php b/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php index e5015ff45..b807a9746 100644 --- a/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php +++ b/pkg/enqueue/Tests/Client/ConsumptionExtension/SetRouterPropertiesExtensionTest.php @@ -7,8 +7,8 @@ use Enqueue\Client\DriverInterface; use Enqueue\Consumption\Context\MessageReceived; use Enqueue\Consumption\MessageReceivedExtensionInterface; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Consumer; use Interop\Queue\Context as InteropContext; diff --git a/pkg/enqueue/Tests/Client/DelegateProcessorTest.php b/pkg/enqueue/Tests/Client/DelegateProcessorTest.php index 40ef17989..8c4e99614 100644 --- a/pkg/enqueue/Tests/Client/DelegateProcessorTest.php +++ b/pkg/enqueue/Tests/Client/DelegateProcessorTest.php @@ -4,7 +4,7 @@ use Enqueue\Client\Config; use Enqueue\Client\DelegateProcessor; -use Enqueue\Null\NullMessage; +use Enqueue\NoEffect\NullMessage; use Enqueue\ProcessorRegistryInterface; use Interop\Queue\Context; use Interop\Queue\Processor; diff --git a/pkg/enqueue/Tests/Client/Driver/GenericDriverTest.php b/pkg/enqueue/Tests/Client/Driver/GenericDriverTest.php index 78f7f6e83..c10848844 100644 --- a/pkg/enqueue/Tests/Client/Driver/GenericDriverTest.php +++ b/pkg/enqueue/Tests/Client/Driver/GenericDriverTest.php @@ -7,9 +7,9 @@ use Enqueue\Client\Driver\GenericDriver; use Enqueue\Client\DriverInterface; use Enqueue\Client\MessagePriority; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; -use Enqueue\Null\NullTopic; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; +use Enqueue\NoEffect\NullTopic; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Context; use Interop\Queue\Message as InteropMessage; diff --git a/pkg/enqueue/Tests/Client/DriverFactoryTest.php b/pkg/enqueue/Tests/Client/DriverFactoryTest.php index cce6311e5..30376eba8 100644 --- a/pkg/enqueue/Tests/Client/DriverFactoryTest.php +++ b/pkg/enqueue/Tests/Client/DriverFactoryTest.php @@ -28,8 +28,8 @@ use Enqueue\Gps\GpsContext; use Enqueue\Mongodb\MongodbConnectionFactory; use Enqueue\Mongodb\MongodbContext; -use Enqueue\Null\NullConnectionFactory; -use Enqueue\Null\NullContext; +use Enqueue\NoEffect\NullConnectionFactory; +use Enqueue\NoEffect\NullContext; use Enqueue\Pheanstalk\PheanstalkConnectionFactory; use Enqueue\Pheanstalk\PheanstalkContext; use Enqueue\RdKafka\RdKafkaConnectionFactory; diff --git a/pkg/enqueue/Tests/Client/RouterProcessorTest.php b/pkg/enqueue/Tests/Client/RouterProcessorTest.php index e2611d09c..5066e09c3 100644 --- a/pkg/enqueue/Tests/Client/RouterProcessorTest.php +++ b/pkg/enqueue/Tests/Client/RouterProcessorTest.php @@ -10,8 +10,8 @@ use Enqueue\Client\RouteCollection; use Enqueue\Client\RouterProcessor; use Enqueue\Consumption\Result; -use Enqueue\Null\NullContext; -use Enqueue\Null\NullMessage; +use Enqueue\NoEffect\NullContext; +use Enqueue\NoEffect\NullMessage; use Enqueue\Test\ClassExtensionTrait; use Enqueue\Test\ReadAttributeTrait; use Interop\Queue\Destination; @@ -188,7 +188,7 @@ public function testShouldDoNotModifyOriginalMessage() $result = $processor->process($message, new NullContext()); - //guard + // guard $this->assertEquals(Result::ACK, $result->getStatus()); $this->assertSame('theBody', $message->getBody()); diff --git a/pkg/enqueue/Tests/ConnectionFactoryFactoryTest.php b/pkg/enqueue/Tests/ConnectionFactoryFactoryTest.php index 3fb4fb57b..278dc378a 100644 --- a/pkg/enqueue/Tests/ConnectionFactoryFactoryTest.php +++ b/pkg/enqueue/Tests/ConnectionFactoryFactoryTest.php @@ -12,7 +12,7 @@ use Enqueue\Gearman\GearmanConnectionFactory; use Enqueue\Gps\GpsConnectionFactory; use Enqueue\Mongodb\MongodbConnectionFactory; -use Enqueue\Null\NullConnectionFactory; +use Enqueue\NoEffect\NullConnectionFactory; use Enqueue\Pheanstalk\PheanstalkConnectionFactory; use Enqueue\RdKafka\RdKafkaConnectionFactory; use Enqueue\Redis\RedisConnectionFactory; diff --git a/pkg/enqueue/Tests/Consumption/CallbackProcessorTest.php b/pkg/enqueue/Tests/Consumption/CallbackProcessorTest.php index f134cfe9f..c762c8841 100644 --- a/pkg/enqueue/Tests/Consumption/CallbackProcessorTest.php +++ b/pkg/enqueue/Tests/Consumption/CallbackProcessorTest.php @@ -3,8 +3,8 @@ namespace Enqueue\Tests\Consumption; use Enqueue\Consumption\CallbackProcessor; -use Enqueue\Null\NullContext; -use Enqueue\Null\NullMessage; +use Enqueue\NoEffect\NullContext; +use Enqueue\NoEffect\NullMessage; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Processor; use PHPUnit\Framework\TestCase; diff --git a/pkg/enqueue/Tests/Consumption/Extension/LogExtensionTest.php b/pkg/enqueue/Tests/Consumption/Extension/LogExtensionTest.php index 4bc4ae95f..f43bd90c7 100644 --- a/pkg/enqueue/Tests/Consumption/Extension/LogExtensionTest.php +++ b/pkg/enqueue/Tests/Consumption/Extension/LogExtensionTest.php @@ -12,8 +12,8 @@ use Enqueue\Consumption\PostMessageReceivedExtensionInterface; use Enqueue\Consumption\Result; use Enqueue\Consumption\StartExtensionInterface; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; use Enqueue\Test\ClassExtensionTrait; use Enqueue\Util\Stringify; use Interop\Queue\Consumer; diff --git a/pkg/enqueue/Tests/Consumption/Extension/ReplyExtensionTest.php b/pkg/enqueue/Tests/Consumption/Extension/ReplyExtensionTest.php index 408895638..c9df6df2e 100644 --- a/pkg/enqueue/Tests/Consumption/Extension/ReplyExtensionTest.php +++ b/pkg/enqueue/Tests/Consumption/Extension/ReplyExtensionTest.php @@ -6,8 +6,8 @@ use Enqueue\Consumption\Extension\ReplyExtension; use Enqueue\Consumption\PostMessageReceivedExtensionInterface; use Enqueue\Consumption\Result; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Consumer; use Interop\Queue\Context; diff --git a/pkg/enqueue/Tests/Consumption/QueueConsumerTest.php b/pkg/enqueue/Tests/Consumption/QueueConsumerTest.php index ecf7f9afa..b8175e0d1 100644 --- a/pkg/enqueue/Tests/Consumption/QueueConsumerTest.php +++ b/pkg/enqueue/Tests/Consumption/QueueConsumerTest.php @@ -20,7 +20,7 @@ use Enqueue\Consumption\ExtensionInterface; use Enqueue\Consumption\QueueConsumer; use Enqueue\Consumption\Result; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullQueue; use Enqueue\Test\ReadAttributeTrait; use Enqueue\Tests\Consumption\Mock\BreakCycleExtension; use Enqueue\Tests\Consumption\Mock\DummySubscriptionConsumer; diff --git a/pkg/enqueue/Tests/Consumption/ResultTest.php b/pkg/enqueue/Tests/Consumption/ResultTest.php index 26b8c7812..8b5deae5f 100644 --- a/pkg/enqueue/Tests/Consumption/ResultTest.php +++ b/pkg/enqueue/Tests/Consumption/ResultTest.php @@ -3,7 +3,7 @@ namespace Enqueue\Tests\Consumption; use Enqueue\Consumption\Result; -use Enqueue\Null\NullMessage; +use Enqueue\NoEffect\NullMessage; use PHPUnit\Framework\TestCase; class ResultTest extends TestCase diff --git a/pkg/enqueue/Tests/Router/RouteRecipientListProcessorTest.php b/pkg/enqueue/Tests/Router/RouteRecipientListProcessorTest.php index 8a2e089f7..587d9ffa1 100644 --- a/pkg/enqueue/Tests/Router/RouteRecipientListProcessorTest.php +++ b/pkg/enqueue/Tests/Router/RouteRecipientListProcessorTest.php @@ -3,8 +3,8 @@ namespace Enqueue\Tests\Router; use Enqueue\Consumption\Result; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; use Enqueue\Router\Recipient; use Enqueue\Router\RecipientListRouterInterface; use Enqueue\Router\RouteRecipientListProcessor; diff --git a/pkg/enqueue/Tests/Rpc/PromiseTest.php b/pkg/enqueue/Tests/Rpc/PromiseTest.php index 6762149ef..dcda0854b 100644 --- a/pkg/enqueue/Tests/Rpc/PromiseTest.php +++ b/pkg/enqueue/Tests/Rpc/PromiseTest.php @@ -2,7 +2,7 @@ namespace Enqueue\Tests\Rpc; -use Enqueue\Null\NullMessage; +use Enqueue\NoEffect\NullMessage; use Enqueue\Rpc\Promise; use PHPUnit\Framework\TestCase; diff --git a/pkg/enqueue/Tests/Rpc/RpcClientTest.php b/pkg/enqueue/Tests/Rpc/RpcClientTest.php index e2035c4d5..f34b580b5 100644 --- a/pkg/enqueue/Tests/Rpc/RpcClientTest.php +++ b/pkg/enqueue/Tests/Rpc/RpcClientTest.php @@ -2,9 +2,9 @@ namespace Enqueue\Tests\Rpc; -use Enqueue\Null\NullContext; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullContext; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; use Enqueue\Rpc\Promise; use Enqueue\Rpc\RpcClient; use Interop\Queue\Consumer; diff --git a/pkg/enqueue/Tests/Symfony/Client/ConsumeCommandTest.php b/pkg/enqueue/Tests/Symfony/Client/ConsumeCommandTest.php index 1d94e6e51..777a8d5b1 100644 --- a/pkg/enqueue/Tests/Symfony/Client/ConsumeCommandTest.php +++ b/pkg/enqueue/Tests/Symfony/Client/ConsumeCommandTest.php @@ -13,7 +13,7 @@ use Enqueue\Consumption\QueueConsumer; use Enqueue\Consumption\QueueConsumerInterface; use Enqueue\Container\Container; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullQueue; use Enqueue\Symfony\Client\ConsumeCommand; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Consumer; diff --git a/pkg/enqueue/Tests/Symfony/Client/Mock/SetupBrokerExtensionCommand.php b/pkg/enqueue/Tests/Symfony/Client/Mock/SetupBrokerExtensionCommand.php index c21750592..482aa69ab 100644 --- a/pkg/enqueue/Tests/Symfony/Client/Mock/SetupBrokerExtensionCommand.php +++ b/pkg/enqueue/Tests/Symfony/Client/Mock/SetupBrokerExtensionCommand.php @@ -5,7 +5,7 @@ use Enqueue\Client\Config; use Enqueue\Client\Driver\GenericDriver; use Enqueue\Client\RouteCollection; -use Enqueue\Null\NullContext; +use Enqueue\NoEffect\NullContext; use Enqueue\Symfony\Client\SetupBrokerExtensionCommandTrait; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; diff --git a/pkg/enqueue/Tests/Symfony/Client/SimpleConsumeCommandTest.php b/pkg/enqueue/Tests/Symfony/Client/SimpleConsumeCommandTest.php index fb89dae32..2303c5aad 100644 --- a/pkg/enqueue/Tests/Symfony/Client/SimpleConsumeCommandTest.php +++ b/pkg/enqueue/Tests/Symfony/Client/SimpleConsumeCommandTest.php @@ -8,7 +8,7 @@ use Enqueue\Client\RouteCollection; use Enqueue\Consumption\ChainExtension; use Enqueue\Consumption\QueueConsumerInterface; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullQueue; use Enqueue\Symfony\Client\ConsumeCommand; use Enqueue\Symfony\Client\SimpleConsumeCommand; use Enqueue\Test\ClassExtensionTrait; diff --git a/pkg/enqueue/Tests/Symfony/Consumption/ConsumeCommandTest.php b/pkg/enqueue/Tests/Symfony/Consumption/ConsumeCommandTest.php index 348397137..6cd7f93f5 100644 --- a/pkg/enqueue/Tests/Symfony/Consumption/ConsumeCommandTest.php +++ b/pkg/enqueue/Tests/Symfony/Consumption/ConsumeCommandTest.php @@ -8,7 +8,7 @@ use Enqueue\Consumption\QueueConsumer; use Enqueue\Consumption\QueueConsumerInterface; use Enqueue\Container\Container; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullQueue; use Enqueue\Symfony\Consumption\ConsumeCommand; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Consumer; diff --git a/pkg/fs/Tests/FsContextTest.php b/pkg/fs/Tests/FsContextTest.php index 4bc05e9de..8357949fd 100644 --- a/pkg/fs/Tests/FsContextTest.php +++ b/pkg/fs/Tests/FsContextTest.php @@ -7,7 +7,7 @@ use Enqueue\Fs\FsDestination; use Enqueue\Fs\FsMessage; use Enqueue\Fs\FsProducer; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullQueue; use Enqueue\Test\ClassExtensionTrait; use Enqueue\Test\ReadAttributeTrait; use Interop\Queue\Context; @@ -116,7 +116,7 @@ public function testShouldThrowIfNotFsDestinationGivenOnCreateConsumer() $context = new FsContext(sys_get_temp_dir(), 1, 0666, 100); $this->expectException(InvalidDestinationException::class); - $this->expectExceptionMessage('The destination must be an instance of Enqueue\Fs\FsDestination but got Enqueue\Null\NullQueue.'); + $this->expectExceptionMessage('The destination must be an instance of Enqueue\Fs\FsDestination but got Enqueue\NoEffect\NullQueue.'); $consumer = $context->createConsumer(new NullQueue('aQueue')); $this->assertInstanceOf(FsConsumer::class, $consumer); diff --git a/pkg/fs/Tests/FsProducerTest.php b/pkg/fs/Tests/FsProducerTest.php index 28700d52f..b1f61e1f0 100644 --- a/pkg/fs/Tests/FsProducerTest.php +++ b/pkg/fs/Tests/FsProducerTest.php @@ -6,8 +6,8 @@ use Enqueue\Fs\FsDestination; use Enqueue\Fs\FsMessage; use Enqueue\Fs\FsProducer; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Exception\InvalidDestinationException; use Interop\Queue\Exception\InvalidMessageException; @@ -33,7 +33,7 @@ public function testThrowIfDestinationNotFsOnSend() $producer = new FsProducer($this->createContextMock()); $this->expectException(InvalidDestinationException::class); - $this->expectExceptionMessage('The destination must be an instance of Enqueue\Fs\FsDestination but got Enqueue\Null\NullQueue.'); + $this->expectExceptionMessage('The destination must be an instance of Enqueue\Fs\FsDestination but got Enqueue\NoEffect\NullQueue.'); $producer->send(new NullQueue('aQueue'), new FsMessage()); } @@ -42,7 +42,7 @@ public function testThrowIfMessageNotFsOnSend() $producer = new FsProducer($this->createContextMock()); $this->expectException(InvalidMessageException::class); - $this->expectExceptionMessage('The message must be an instance of Enqueue\Fs\FsMessage but it is Enqueue\Null\NullMessage.'); + $this->expectExceptionMessage('The message must be an instance of Enqueue\Fs\FsMessage but it is Enqueue\NoEffect\NullMessage.'); $producer->send(new FsDestination(TempFile::generate()), new NullMessage()); } diff --git a/pkg/gearman/Tests/GearmanContextTest.php b/pkg/gearman/Tests/GearmanContextTest.php index 484ab00a0..c9b895d8e 100644 --- a/pkg/gearman/Tests/GearmanContextTest.php +++ b/pkg/gearman/Tests/GearmanContextTest.php @@ -3,7 +3,7 @@ namespace Enqueue\Gearman\Tests; use Enqueue\Gearman\GearmanContext; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullQueue; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Context; use Interop\Queue\Exception\InvalidDestinationException; diff --git a/pkg/gearman/Tests/GearmanProducerTest.php b/pkg/gearman/Tests/GearmanProducerTest.php index afb6181a3..a94e43738 100644 --- a/pkg/gearman/Tests/GearmanProducerTest.php +++ b/pkg/gearman/Tests/GearmanProducerTest.php @@ -5,8 +5,8 @@ use Enqueue\Gearman\GearmanDestination; use Enqueue\Gearman\GearmanMessage; use Enqueue\Gearman\GearmanProducer; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Exception\InvalidDestinationException; use Interop\Queue\Exception\InvalidMessageException; @@ -28,7 +28,7 @@ public function testThrowIfDestinationInvalid() $producer = new GearmanProducer($this->createGearmanClientMock()); $this->expectException(InvalidDestinationException::class); - $this->expectExceptionMessage('The destination must be an instance of Enqueue\Gearman\GearmanDestination but got Enqueue\Null\NullQueue.'); + $this->expectExceptionMessage('The destination must be an instance of Enqueue\Gearman\GearmanDestination but got Enqueue\NoEffect\NullQueue.'); $producer->send(new NullQueue('aQueue'), new GearmanMessage()); } @@ -37,7 +37,7 @@ public function testThrowIfMessageInvalid() $producer = new GearmanProducer($this->createGearmanClientMock()); $this->expectException(InvalidMessageException::class); - $this->expectExceptionMessage('The message must be an instance of Enqueue\Gearman\GearmanMessage but it is Enqueue\Null\NullMessage.'); + $this->expectExceptionMessage('The message must be an instance of Enqueue\Gearman\GearmanMessage but it is Enqueue\NoEffect\NullMessage.'); $producer->send(new GearmanDestination('aQueue'), new NullMessage()); } @@ -57,7 +57,7 @@ public function testShouldJsonEncodeMessageAndPutToExpectedTube() $gearman ->expects($this->once()) ->method('returnCode') - ->willReturn(\GEARMAN_SUCCESS) + ->willReturn(GEARMAN_SUCCESS) ; $producer = new GearmanProducer($gearman); diff --git a/pkg/job-queue/Tests/CalculateRootJobStatusProcessorTest.php b/pkg/job-queue/Tests/CalculateRootJobStatusProcessorTest.php index 2e5a6ac4c..d56ccd340 100644 --- a/pkg/job-queue/Tests/CalculateRootJobStatusProcessorTest.php +++ b/pkg/job-queue/Tests/CalculateRootJobStatusProcessorTest.php @@ -10,7 +10,7 @@ use Enqueue\JobQueue\Doctrine\JobStorage; use Enqueue\JobQueue\Job; use Enqueue\JobQueue\Topics; -use Enqueue\Null\NullMessage; +use Enqueue\NoEffect\NullMessage; use Interop\Queue\Context; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; diff --git a/pkg/job-queue/Tests/DependentJobProcessorTest.php b/pkg/job-queue/Tests/DependentJobProcessorTest.php index fff9517a4..12fe173fe 100644 --- a/pkg/job-queue/Tests/DependentJobProcessorTest.php +++ b/pkg/job-queue/Tests/DependentJobProcessorTest.php @@ -9,7 +9,7 @@ use Enqueue\JobQueue\Doctrine\JobStorage; use Enqueue\JobQueue\Job; use Enqueue\JobQueue\Topics; -use Enqueue\Null\NullMessage; +use Enqueue\NoEffect\NullMessage; use Interop\Queue\Context; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; diff --git a/pkg/pheanstalk/Tests/PheanstalkContextTest.php b/pkg/pheanstalk/Tests/PheanstalkContextTest.php index 9f5ac5812..aa6efe9a4 100644 --- a/pkg/pheanstalk/Tests/PheanstalkContextTest.php +++ b/pkg/pheanstalk/Tests/PheanstalkContextTest.php @@ -2,7 +2,7 @@ namespace Enqueue\Pheanstalk\Tests; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullQueue; use Enqueue\Pheanstalk\PheanstalkContext; use Enqueue\Test\ClassExtensionTrait; use Interop\Queue\Context; diff --git a/pkg/pheanstalk/Tests/PheanstalkProducerTest.php b/pkg/pheanstalk/Tests/PheanstalkProducerTest.php index 7a736c09e..11635be39 100644 --- a/pkg/pheanstalk/Tests/PheanstalkProducerTest.php +++ b/pkg/pheanstalk/Tests/PheanstalkProducerTest.php @@ -2,8 +2,8 @@ namespace Enqueue\Pheanstalk\Tests; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; use Enqueue\Pheanstalk\PheanstalkDestination; use Enqueue\Pheanstalk\PheanstalkMessage; use Enqueue\Pheanstalk\PheanstalkProducer; @@ -28,7 +28,7 @@ public function testThrowIfDestinationInvalid() $producer = new PheanstalkProducer($this->createPheanstalkMock()); $this->expectException(InvalidDestinationException::class); - $this->expectExceptionMessage('The destination must be an instance of Enqueue\Pheanstalk\PheanstalkDestination but got Enqueue\Null\NullQueue.'); + $this->expectExceptionMessage('The destination must be an instance of Enqueue\Pheanstalk\PheanstalkDestination but got Enqueue\NoEffect\NullQueue.'); $producer->send(new NullQueue('aQueue'), new PheanstalkMessage()); } @@ -37,7 +37,7 @@ public function testThrowIfMessageInvalid() $producer = new PheanstalkProducer($this->createPheanstalkMock()); $this->expectException(InvalidMessageException::class); - $this->expectExceptionMessage('The message must be an instance of Enqueue\Pheanstalk\PheanstalkMessage but it is Enqueue\Null\NullMessage.'); + $this->expectExceptionMessage('The message must be an instance of Enqueue\Pheanstalk\PheanstalkMessage but it is Enqueue\NoEffect\NullMessage.'); $producer->send(new PheanstalkDestination('aQueue'), new NullMessage()); } diff --git a/pkg/rdkafka/Tests/RdKafkaContextTest.php b/pkg/rdkafka/Tests/RdKafkaContextTest.php index 227eea792..cfd4cdf54 100644 --- a/pkg/rdkafka/Tests/RdKafkaContextTest.php +++ b/pkg/rdkafka/Tests/RdKafkaContextTest.php @@ -2,7 +2,7 @@ namespace Enqueue\RdKafka\Tests; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullQueue; use Enqueue\RdKafka\JsonSerializer; use Enqueue\RdKafka\RdKafkaContext; use Enqueue\RdKafka\Serializer; diff --git a/pkg/rdkafka/Tests/RdKafkaProducerTest.php b/pkg/rdkafka/Tests/RdKafkaProducerTest.php index 01c1c1b4c..e5417ccf7 100644 --- a/pkg/rdkafka/Tests/RdKafkaProducerTest.php +++ b/pkg/rdkafka/Tests/RdKafkaProducerTest.php @@ -2,8 +2,8 @@ namespace Enqueue\RdKafka\Tests; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; use Enqueue\RdKafka\RdKafkaMessage; use Enqueue\RdKafka\RdKafkaProducer; use Enqueue\RdKafka\RdKafkaTopic; @@ -30,7 +30,7 @@ public function testThrowIfDestinationInvalid() $producer = new RdKafkaProducer($this->createKafkaProducerMock(), $this->createSerializerMock()); $this->expectException(InvalidDestinationException::class); - $this->expectExceptionMessage('The destination must be an instance of Enqueue\RdKafka\RdKafkaTopic but got Enqueue\Null\NullQueue.'); + $this->expectExceptionMessage('The destination must be an instance of Enqueue\RdKafka\RdKafkaTopic but got Enqueue\NoEffect\NullQueue.'); $producer->send(new NullQueue('aQueue'), new RdKafkaMessage()); } @@ -39,7 +39,7 @@ public function testThrowIfMessageInvalid() $producer = new RdKafkaProducer($this->createKafkaProducerMock(), $this->createSerializerMock()); $this->expectException(InvalidMessageException::class); - $this->expectExceptionMessage('The message must be an instance of Enqueue\RdKafka\RdKafkaMessage but it is Enqueue\Null\NullMessage.'); + $this->expectExceptionMessage('The message must be an instance of Enqueue\RdKafka\RdKafkaMessage but it is Enqueue\NoEffect\NullMessage.'); $producer->send(new RdKafkaTopic('aQueue'), new NullMessage()); } @@ -172,7 +172,7 @@ public function testShouldAllowGetPreviouslySetSerializer() $expectedSerializer = $this->createSerializerMock(); - //guard + // guard $this->assertNotSame($producer->getSerializer(), $expectedSerializer); $producer->setSerializer($expectedSerializer); diff --git a/pkg/redis/Tests/RedisContextTest.php b/pkg/redis/Tests/RedisContextTest.php index 0115f27b8..fb258d578 100644 --- a/pkg/redis/Tests/RedisContextTest.php +++ b/pkg/redis/Tests/RedisContextTest.php @@ -2,8 +2,8 @@ namespace Enqueue\Redis\Tests; -use Enqueue\Null\NullQueue; -use Enqueue\Null\NullTopic; +use Enqueue\NoEffect\NullQueue; +use Enqueue\NoEffect\NullTopic; use Enqueue\Redis\Redis; use Enqueue\Redis\RedisConsumer; use Enqueue\Redis\RedisContext; @@ -113,7 +113,7 @@ public function testShouldThrowIfNotRedisDestinationGivenOnCreateConsumer() $context = new RedisContext($this->createRedisMock(), 300); $this->expectException(InvalidDestinationException::class); - $this->expectExceptionMessage('The destination must be an instance of Enqueue\Redis\RedisDestination but got Enqueue\Null\NullQueue.'); + $this->expectExceptionMessage('The destination must be an instance of Enqueue\Redis\RedisDestination but got Enqueue\NoEffect\NullQueue.'); $consumer = $context->createConsumer(new NullQueue('aQueue')); $this->assertInstanceOf(RedisConsumer::class, $consumer); diff --git a/pkg/redis/Tests/RedisProducerTest.php b/pkg/redis/Tests/RedisProducerTest.php index 53d5f19e3..d41302117 100644 --- a/pkg/redis/Tests/RedisProducerTest.php +++ b/pkg/redis/Tests/RedisProducerTest.php @@ -2,8 +2,8 @@ namespace Enqueue\Redis\Tests; -use Enqueue\Null\NullMessage; -use Enqueue\Null\NullQueue; +use Enqueue\NoEffect\NullMessage; +use Enqueue\NoEffect\NullQueue; use Enqueue\Redis\JsonSerializer; use Enqueue\Redis\Redis; use Enqueue\Redis\RedisContext; @@ -35,7 +35,7 @@ public function testThrowIfDestinationNotRedisDestinationOnSend() $producer = new RedisProducer($this->createContextMock()); $this->expectException(InvalidDestinationException::class); - $this->expectExceptionMessage('The destination must be an instance of Enqueue\Redis\RedisDestination but got Enqueue\Null\NullQueue.'); + $this->expectExceptionMessage('The destination must be an instance of Enqueue\Redis\RedisDestination but got Enqueue\NoEffect\NullQueue.'); $producer->send(new NullQueue('aQueue'), new RedisMessage()); } @@ -44,7 +44,7 @@ public function testThrowIfMessageNotRedisMessageOnSend() $producer = new RedisProducer($this->createContextMock()); $this->expectException(InvalidMessageException::class); - $this->expectExceptionMessage('The message must be an instance of Enqueue\Redis\RedisMessage but it is Enqueue\Null\NullMessage.'); + $this->expectExceptionMessage('The message must be an instance of Enqueue\Redis\RedisMessage but it is Enqueue\NoEffect\NullMessage.'); $producer->send(new RedisDestination('aQueue'), new NullMessage()); } From 7f2f4db8dbace582c320968e75bed1b469dc210c Mon Sep 17 00:00:00 2001 From: Norbert Papp Date: Sun, 29 May 2022 21:04:30 +0200 Subject: [PATCH 4/6] refactor(namespaces): unnecessary characters removed from composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 856f10787..73adcbbbf 100644 --- a/composer.json +++ b/composer.json @@ -88,7 +88,7 @@ "Enqueue\\Gps\\": "pkg/gps/", "Enqueue\\JobQueue\\": "pkg/job-queue/", "Enqueue\\Mongodb\\": "pkg/mongodb/", - "Enqueue\\NoEffect\\\\": "pkg/null/", + "Enqueue\\NoEffect\\": "pkg/null/", "Enqueue\\Pheanstalk\\": "pkg/pheanstalk/", "Enqueue\\RdKafka\\": "pkg/rdkafka/", "Enqueue\\Redis\\": "pkg/redis/", From 0de60e020814e69dafd02857ad57353848478ec4 Mon Sep 17 00:00:00 2001 From: Norbert Papp Date: Mon, 30 May 2022 09:04:33 +0200 Subject: [PATCH 5/6] refactor(null): Enqueue\Null got back its original namespace feat(noeffect): new package introduced called Enqueue\NoEffect which is used in other enqueue packages as well from now --- composer.json | 3 +- pkg/noeffect/.gitattributes | 5 + pkg/noeffect/.github/workflows/ci.yml | 29 ++++ pkg/noeffect/.gitignore | 6 + pkg/noeffect/LICENSE | 20 +++ pkg/noeffect/NullConnectionFactory.php | 19 +++ pkg/noeffect/NullConsumer.php | 52 ++++++ pkg/noeffect/NullContext.php | 86 ++++++++++ pkg/noeffect/NullMessage.php | 150 ++++++++++++++++++ pkg/noeffect/NullProducer.php | 67 ++++++++ pkg/noeffect/NullQueue.php | 25 +++ pkg/noeffect/NullSubscriptionConsumer.php | 27 ++++ pkg/noeffect/NullTopic.php | 23 +++ pkg/noeffect/README.md | 36 +++++ .../Tests/NullConnectionFactoryTest.php | 33 ++++ pkg/noeffect/Tests/NullConsumerTest.php | 57 +++++++ pkg/noeffect/Tests/NullContextTest.php | 105 ++++++++++++ pkg/noeffect/Tests/NullMessageTest.php | 36 +++++ pkg/noeffect/Tests/NullProducerTest.php | 32 ++++ pkg/noeffect/Tests/NullQueueTest.php | 30 ++++ pkg/noeffect/Tests/NullTopicTest.php | 30 ++++ pkg/noeffect/Tests/Spec/NullMessageTest.php | 17 ++ pkg/noeffect/composer.json | 36 +++++ pkg/noeffect/phpunit.xml.dist | 26 +++ pkg/null/NullConnectionFactory.php | 2 +- pkg/null/NullConsumer.php | 2 +- pkg/null/NullContext.php | 2 +- pkg/null/NullMessage.php | 2 +- pkg/null/NullProducer.php | 2 +- pkg/null/NullQueue.php | 2 +- pkg/null/NullSubscriptionConsumer.php | 2 +- pkg/null/NullTopic.php | 2 +- pkg/null/Tests/NullConnectionFactoryTest.php | 6 +- pkg/null/Tests/NullConsumerTest.php | 8 +- pkg/null/Tests/NullContextTest.php | 16 +- pkg/null/Tests/NullMessageTest.php | 4 +- pkg/null/Tests/NullProducerTest.php | 8 +- pkg/null/Tests/NullQueueTest.php | 4 +- pkg/null/Tests/NullTopicTest.php | 4 +- pkg/null/Tests/Spec/NullMessageTest.php | 4 +- pkg/null/composer.json | 2 +- 41 files changed, 985 insertions(+), 37 deletions(-) create mode 100644 pkg/noeffect/.gitattributes create mode 100644 pkg/noeffect/.github/workflows/ci.yml create mode 100644 pkg/noeffect/.gitignore create mode 100644 pkg/noeffect/LICENSE create mode 100644 pkg/noeffect/NullConnectionFactory.php create mode 100644 pkg/noeffect/NullConsumer.php create mode 100644 pkg/noeffect/NullContext.php create mode 100644 pkg/noeffect/NullMessage.php create mode 100644 pkg/noeffect/NullProducer.php create mode 100644 pkg/noeffect/NullQueue.php create mode 100644 pkg/noeffect/NullSubscriptionConsumer.php create mode 100644 pkg/noeffect/NullTopic.php create mode 100644 pkg/noeffect/README.md create mode 100644 pkg/noeffect/Tests/NullConnectionFactoryTest.php create mode 100644 pkg/noeffect/Tests/NullConsumerTest.php create mode 100644 pkg/noeffect/Tests/NullContextTest.php create mode 100644 pkg/noeffect/Tests/NullMessageTest.php create mode 100644 pkg/noeffect/Tests/NullProducerTest.php create mode 100644 pkg/noeffect/Tests/NullQueueTest.php create mode 100644 pkg/noeffect/Tests/NullTopicTest.php create mode 100644 pkg/noeffect/Tests/Spec/NullMessageTest.php create mode 100644 pkg/noeffect/composer.json create mode 100644 pkg/noeffect/phpunit.xml.dist diff --git a/composer.json b/composer.json index 73adcbbbf..38262420b 100644 --- a/composer.json +++ b/composer.json @@ -88,7 +88,8 @@ "Enqueue\\Gps\\": "pkg/gps/", "Enqueue\\JobQueue\\": "pkg/job-queue/", "Enqueue\\Mongodb\\": "pkg/mongodb/", - "Enqueue\\NoEffect\\": "pkg/null/", + "Enqueue\\NoEffect\\": "pkg/noeffect/", + "Enqueue\\Null\\": "pkg/null/", "Enqueue\\Pheanstalk\\": "pkg/pheanstalk/", "Enqueue\\RdKafka\\": "pkg/rdkafka/", "Enqueue\\Redis\\": "pkg/redis/", diff --git a/pkg/noeffect/.gitattributes b/pkg/noeffect/.gitattributes new file mode 100644 index 000000000..bdf2dcb14 --- /dev/null +++ b/pkg/noeffect/.gitattributes @@ -0,0 +1,5 @@ +/Tests export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.travis.yml export-ignore +phpunit.xml.dist export-ignore diff --git a/pkg/noeffect/.github/workflows/ci.yml b/pkg/noeffect/.github/workflows/ci.yml new file mode 100644 index 000000000..a168dca05 --- /dev/null +++ b/pkg/noeffect/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI +on: + pull_request: + push: + branches: + - master +jobs: + tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: ['7.3', '7.4', '8.0'] + + name: PHP ${{ matrix.php }} tests + + steps: + - uses: actions/checkout@v2 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - uses: "ramsey/composer-install@v1" + with: + composer-options: "--prefer-source" + + - run: vendor/bin/phpunit --exclude-group=functional diff --git a/pkg/noeffect/.gitignore b/pkg/noeffect/.gitignore new file mode 100644 index 000000000..a770439e5 --- /dev/null +++ b/pkg/noeffect/.gitignore @@ -0,0 +1,6 @@ +*~ +/composer.lock +/composer.phar +/phpunit.xml +/vendor/ +/.idea/ diff --git a/pkg/noeffect/LICENSE b/pkg/noeffect/LICENSE new file mode 100644 index 000000000..d9fa0fd46 --- /dev/null +++ b/pkg/noeffect/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2013 Oro, Inc +Copyright (c) 2017 Kotliar Maksym + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/pkg/noeffect/NullConnectionFactory.php b/pkg/noeffect/NullConnectionFactory.php new file mode 100644 index 000000000..3060fc18e --- /dev/null +++ b/pkg/noeffect/NullConnectionFactory.php @@ -0,0 +1,19 @@ +queue = $queue; + } + + public function getQueue(): Queue + { + return $this->queue; + } + + /** + * @return NullMessage + */ + public function receive(int $timeout = 0): ?Message + { + return null; + } + + /** + * @return NullMessage + */ + public function receiveNoWait(): ?Message + { + return null; + } + + public function acknowledge(Message $message): void + { + } + + public function reject(Message $message, bool $requeue = false): void + { + } +} diff --git a/pkg/noeffect/NullContext.php b/pkg/noeffect/NullContext.php new file mode 100644 index 000000000..7b42305ec --- /dev/null +++ b/pkg/noeffect/NullContext.php @@ -0,0 +1,86 @@ +setBody($body); + $message->setProperties($properties); + $message->setHeaders($headers); + + return $message; + } + + /** + * @return NullQueue + */ + public function createQueue(string $name): Queue + { + return new NullQueue($name); + } + + /** + * @return NullQueue + */ + public function createTemporaryQueue(): Queue + { + return $this->createQueue(uniqid('', true)); + } + + /** + * @return NullTopic + */ + public function createTopic(string $name): Topic + { + return new NullTopic($name); + } + + /** + * @return NullConsumer + */ + public function createConsumer(Destination $destination): Consumer + { + return new NullConsumer($destination); + } + + /** + * @return NullProducer + */ + public function createProducer(): Producer + { + return new NullProducer(); + } + + /** + * @return NullSubscriptionConsumer + */ + public function createSubscriptionConsumer(): SubscriptionConsumer + { + return new NullSubscriptionConsumer(); + } + + public function purgeQueue(Queue $queue): void + { + } + + public function close(): void + { + } +} diff --git a/pkg/noeffect/NullMessage.php b/pkg/noeffect/NullMessage.php new file mode 100644 index 000000000..26a439fbf --- /dev/null +++ b/pkg/noeffect/NullMessage.php @@ -0,0 +1,150 @@ +body = $body; + $this->properties = $properties; + $this->headers = $headers; + + $this->redelivered = false; + } + + public function setBody(string $body): void + { + $this->body = $body; + } + + public function getBody(): string + { + return $this->body; + } + + public function setProperties(array $properties): void + { + $this->properties = $properties; + } + + public function getProperties(): array + { + return $this->properties; + } + + public function setProperty(string $name, $value): void + { + $this->properties[$name] = $value; + } + + public function getProperty(string $name, $default = null) + { + return array_key_exists($name, $this->properties) ? $this->properties[$name] : $default; + } + + public function setHeaders(array $headers): void + { + $this->headers = $headers; + } + + public function getHeaders(): array + { + return $this->headers; + } + + public function setHeader(string $name, $value): void + { + $this->headers[$name] = $value; + } + + public function getHeader(string $name, $default = null) + { + return array_key_exists($name, $this->headers) ? $this->headers[$name] : $default; + } + + public function isRedelivered(): bool + { + return $this->redelivered; + } + + public function setRedelivered(bool $redelivered): void + { + $this->redelivered = $redelivered; + } + + public function setCorrelationId(string $correlationId = null): void + { + $headers = $this->getHeaders(); + $headers['correlation_id'] = (string) $correlationId; + + $this->setHeaders($headers); + } + + public function getCorrelationId(): ?string + { + return $this->getHeader('correlation_id'); + } + + public function setMessageId(string $messageId = null): void + { + $headers = $this->getHeaders(); + $headers['message_id'] = (string) $messageId; + + $this->setHeaders($headers); + } + + public function getMessageId(): ?string + { + return $this->getHeader('message_id'); + } + + public function getTimestamp(): ?int + { + $value = $this->getHeader('timestamp'); + + return null === $value ? null : (int) $value; + } + + public function setTimestamp(int $timestamp = null): void + { + $headers = $this->getHeaders(); + $headers['timestamp'] = (int) $timestamp; + + $this->setHeaders($headers); + } + + public function setReplyTo(string $replyTo = null): void + { + $this->setHeader('reply_to', $replyTo); + } + + public function getReplyTo(): ?string + { + return $this->getHeader('reply_to'); + } +} diff --git a/pkg/noeffect/NullProducer.php b/pkg/noeffect/NullProducer.php new file mode 100644 index 000000000..62de43b54 --- /dev/null +++ b/pkg/noeffect/NullProducer.php @@ -0,0 +1,67 @@ +deliveryDelay = $deliveryDelay; + + return $this; + } + + public function getDeliveryDelay(): ?int + { + return $this->deliveryDelay; + } + + /** + * @return NullProducer + */ + public function setPriority(int $priority = null): Producer + { + $this->priority = $priority; + + return $this; + } + + public function getPriority(): ?int + { + return $this->priority; + } + + /** + * @return NullProducer + */ + public function setTimeToLive(int $timeToLive = null): Producer + { + $this->timeToLive = $timeToLive; + + return $this; + } + + public function getTimeToLive(): ?int + { + return $this->timeToLive; + } +} diff --git a/pkg/noeffect/NullQueue.php b/pkg/noeffect/NullQueue.php new file mode 100644 index 000000000..fef315d39 --- /dev/null +++ b/pkg/noeffect/NullQueue.php @@ -0,0 +1,25 @@ +name = $name; + } + + public function getQueueName(): string + { + return $this->name; + } +} diff --git a/pkg/noeffect/NullSubscriptionConsumer.php b/pkg/noeffect/NullSubscriptionConsumer.php new file mode 100644 index 000000000..bd8896566 --- /dev/null +++ b/pkg/noeffect/NullSubscriptionConsumer.php @@ -0,0 +1,27 @@ +name = $name; + } + + public function getTopicName(): string + { + return $this->name; + } +} diff --git a/pkg/noeffect/README.md b/pkg/noeffect/README.md new file mode 100644 index 000000000..3b76f62a5 --- /dev/null +++ b/pkg/noeffect/README.md @@ -0,0 +1,36 @@ +

Supporting Enqueue

+ +Enqueue is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider: + +- [Become a sponsor](https://www.patreon.com/makasim) +- [Become our client](http://forma-pro.com/) + +--- + +# Enqueue Null (NoEffect) Transport + +[![Gitter](https://badges.gitter.im/php-enqueue/Lobby.svg)](https://gitter.im/php-enqueue/Lobby) +[![Build Status](https://img.shields.io/github/workflow/status/php-enqueue/noeffect/CI)](https://github.com/php-enqueue/noeffect/actions?query=workflow%3ACI) +[![Total Downloads](https://poser.pugx.org/enqueue/null/d/total.png)](https://packagist.org/packages/enqueue/noeffect) +[![Latest Stable Version](https://poser.pugx.org/enqueue/noeffect/version.png)](https://packagist.org/packages/enqueue/noeffect) + +This is an implementation of Queue Interop specification. It does not send messages any where and could be used as mock. Suitable in tests. + +## Resources + +* [Site](https://enqueue.forma-pro.com/) +* [Documentation](https://php-enqueue.github.io/transport/null/) +* [Questions](https://gitter.im/php-enqueue/Lobby) +* [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues) + +## Developed by Forma-Pro + +Forma-Pro is a full stack development company which interests also spread to open source development. +Being a team of strong professionals we have an aim an ability to help community by developing cutting edge solutions in the areas of e-commerce, docker & microservice oriented architecture where we have accumulated a huge many-years experience. +Our main specialization is Symfony framework based solution, but we are always looking to the technologies that allow us to do our job the best way. We are committed to creating solutions that revolutionize the way how things are developed in aspects of architecture & scalability. + +If you have any questions and inquires about our open source development, this product particularly or any other matter feel free to contact at opensource@forma-pro.com + +## License + +It is released under the [MIT License](LICENSE). diff --git a/pkg/noeffect/Tests/NullConnectionFactoryTest.php b/pkg/noeffect/Tests/NullConnectionFactoryTest.php new file mode 100644 index 000000000..f34eb9242 --- /dev/null +++ b/pkg/noeffect/Tests/NullConnectionFactoryTest.php @@ -0,0 +1,33 @@ +assertClassImplements(ConnectionFactory::class, NullConnectionFactory::class); + } + + public function testCouldBeConstructedWithoutAnyArguments() + { + new NullConnectionFactory(); + } + + public function testShouldReturnNullContextOnCreateContextCall() + { + $factory = new NullConnectionFactory(); + + $context = $factory->createContext(); + + $this->assertInstanceOf(NullContext::class, $context); + } +} diff --git a/pkg/noeffect/Tests/NullConsumerTest.php b/pkg/noeffect/Tests/NullConsumerTest.php new file mode 100644 index 000000000..24a7cc129 --- /dev/null +++ b/pkg/noeffect/Tests/NullConsumerTest.php @@ -0,0 +1,57 @@ +assertClassImplements(Consumer::class, NullConsumer::class); + } + + public function testCouldBeConstructedWithQueueAsArgument() + { + new NullConsumer(new NullQueue('aName')); + } + + public function testShouldAlwaysReturnNullOnReceive() + { + $consumer = new NullConsumer(new NullQueue('theQueueName')); + + $this->assertNull($consumer->receive()); + $this->assertNull($consumer->receive()); + $this->assertNull($consumer->receive()); + } + + public function testShouldAlwaysReturnNullOnReceiveNoWait() + { + $consumer = new NullConsumer(new NullQueue('theQueueName')); + + $this->assertNull($consumer->receiveNoWait()); + $this->assertNull($consumer->receiveNoWait()); + $this->assertNull($consumer->receiveNoWait()); + } + + public function testShouldDoNothingOnAcknowledge() + { + $consumer = new NullConsumer(new NullQueue('theQueueName')); + + $consumer->acknowledge(new NullMessage()); + } + + public function testShouldDoNothingOnReject() + { + $consumer = new NullConsumer(new NullQueue('theQueueName')); + + $consumer->reject(new NullMessage()); + } +} diff --git a/pkg/noeffect/Tests/NullContextTest.php b/pkg/noeffect/Tests/NullContextTest.php new file mode 100644 index 000000000..63d83cac9 --- /dev/null +++ b/pkg/noeffect/Tests/NullContextTest.php @@ -0,0 +1,105 @@ +assertClassImplements(Context::class, NullContext::class); + } + + public function testCouldBeConstructedWithoutAnyArguments() + { + new NullContext(); + } + + public function testShouldAllowCreateMessageWithoutAnyArguments() + { + $context = new NullContext(); + + $message = $context->createMessage(); + + $this->assertInstanceOf(NullMessage::class, $message); + + $this->assertSame('', $message->getBody()); + $this->assertSame([], $message->getHeaders()); + $this->assertSame([], $message->getProperties()); + } + + public function testShouldAllowCreateCustomMessage() + { + $context = new NullContext(); + + $message = $context->createMessage('theBody', ['theProperty'], ['theHeader']); + + $this->assertInstanceOf(NullMessage::class, $message); + + $this->assertSame('theBody', $message->getBody()); + $this->assertSame(['theProperty'], $message->getProperties()); + $this->assertSame(['theHeader'], $message->getHeaders()); + } + + public function testShouldAllowCreateQueue() + { + $context = new NullContext(); + + $queue = $context->createQueue('aName'); + + $this->assertInstanceOf(NullQueue::class, $queue); + } + + public function testShouldAllowCreateTopic() + { + $context = new NullContext(); + + $topic = $context->createTopic('aName'); + + $this->assertInstanceOf(NullTopic::class, $topic); + } + + public function testShouldAllowCreateConsumerForGivenQueue() + { + $context = new NullContext(); + + $queue = new NullQueue('aName'); + + $consumer = $context->createConsumer($queue); + + $this->assertInstanceOf(NullConsumer::class, $consumer); + } + + public function testShouldAllowCreateProducer() + { + $context = new NullContext(); + + $producer = $context->createProducer(); + + $this->assertInstanceOf(NullProducer::class, $producer); + } + + public function testShouldCreateTemporaryQueueWithUniqueName() + { + $context = new NullContext(); + + $firstTmpQueue = $context->createTemporaryQueue(); + $secondTmpQueue = $context->createTemporaryQueue(); + + $this->assertInstanceOf(NullQueue::class, $firstTmpQueue); + $this->assertInstanceOf(NullQueue::class, $secondTmpQueue); + + $this->assertNotEquals($firstTmpQueue->getQueueName(), $secondTmpQueue->getQueueName()); + } +} diff --git a/pkg/noeffect/Tests/NullMessageTest.php b/pkg/noeffect/Tests/NullMessageTest.php new file mode 100644 index 000000000..59cb8ffae --- /dev/null +++ b/pkg/noeffect/Tests/NullMessageTest.php @@ -0,0 +1,36 @@ +assertClassImplements(Message::class, NullMessage::class); + } + + public function testCouldBeConstructedWithoutAnyArguments() + { + $message = new NullMessage(); + + $this->assertSame('', $message->getBody()); + $this->assertSame([], $message->getProperties()); + $this->assertSame([], $message->getHeaders()); + } + + public function testCouldBeConstructedWithOptionalArguments() + { + $message = new NullMessage('theBody', ['barProp' => 'barPropVal'], ['fooHeader' => 'fooHeaderVal']); + + $this->assertSame('theBody', $message->getBody()); + $this->assertSame(['barProp' => 'barPropVal'], $message->getProperties()); + $this->assertSame(['fooHeader' => 'fooHeaderVal'], $message->getHeaders()); + } +} diff --git a/pkg/noeffect/Tests/NullProducerTest.php b/pkg/noeffect/Tests/NullProducerTest.php new file mode 100644 index 000000000..b6bc0d975 --- /dev/null +++ b/pkg/noeffect/Tests/NullProducerTest.php @@ -0,0 +1,32 @@ +assertClassImplements(Producer::class, NullProducer::class); + } + + public function testCouldBeConstructedWithoutAnyArguments() + { + new NullProducer(); + } + + public function testShouldDoNothingOnSend() + { + $producer = new NullProducer(); + + $producer->send(new NullTopic('aName'), new NullMessage()); + } +} diff --git a/pkg/noeffect/Tests/NullQueueTest.php b/pkg/noeffect/Tests/NullQueueTest.php new file mode 100644 index 000000000..e72e52462 --- /dev/null +++ b/pkg/noeffect/Tests/NullQueueTest.php @@ -0,0 +1,30 @@ +assertClassImplements(Queue::class, NullQueue::class); + } + + public function testCouldBeConstructedWithNameAsArgument() + { + new NullQueue('aName'); + } + + public function testShouldAllowGetNameSetInConstructor() + { + $queue = new NullQueue('theName'); + + $this->assertEquals('theName', $queue->getQueueName()); + } +} diff --git a/pkg/noeffect/Tests/NullTopicTest.php b/pkg/noeffect/Tests/NullTopicTest.php new file mode 100644 index 000000000..e32a551a9 --- /dev/null +++ b/pkg/noeffect/Tests/NullTopicTest.php @@ -0,0 +1,30 @@ +assertClassImplements(Topic::class, NullTopic::class); + } + + public function testCouldBeConstructedWithNameAsArgument() + { + new NullTopic('aName'); + } + + public function testShouldAllowGetNameSetInConstructor() + { + $topic = new NullTopic('theName'); + + $this->assertEquals('theName', $topic->getTopicName()); + } +} diff --git a/pkg/noeffect/Tests/Spec/NullMessageTest.php b/pkg/noeffect/Tests/Spec/NullMessageTest.php new file mode 100644 index 000000000..4d7e3792d --- /dev/null +++ b/pkg/noeffect/Tests/Spec/NullMessageTest.php @@ -0,0 +1,17 @@ + + + + + + + ./Tests + + + + + + . + + ./vendor + ./Resources + ./Tests + + + + diff --git a/pkg/null/NullConnectionFactory.php b/pkg/null/NullConnectionFactory.php index 3060fc18e..b89cd5089 100644 --- a/pkg/null/NullConnectionFactory.php +++ b/pkg/null/NullConnectionFactory.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\NoEffect; +namespace Enqueue\Null; use Interop\Queue\ConnectionFactory; use Interop\Queue\Context; diff --git a/pkg/null/NullConsumer.php b/pkg/null/NullConsumer.php index 19f067f9b..d9b234870 100644 --- a/pkg/null/NullConsumer.php +++ b/pkg/null/NullConsumer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\NoEffect; +namespace Enqueue\Null; use Interop\Queue\Consumer; use Interop\Queue\Destination; diff --git a/pkg/null/NullContext.php b/pkg/null/NullContext.php index 7b42305ec..5f6001cab 100644 --- a/pkg/null/NullContext.php +++ b/pkg/null/NullContext.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\NoEffect; +namespace Enqueue\Null; use Interop\Queue\Consumer; use Interop\Queue\Context; diff --git a/pkg/null/NullMessage.php b/pkg/null/NullMessage.php index 26a439fbf..bd48a387e 100644 --- a/pkg/null/NullMessage.php +++ b/pkg/null/NullMessage.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\NoEffect; +namespace Enqueue\Null; use Interop\Queue\Message; diff --git a/pkg/null/NullProducer.php b/pkg/null/NullProducer.php index 62de43b54..47235e7f6 100644 --- a/pkg/null/NullProducer.php +++ b/pkg/null/NullProducer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\NoEffect; +namespace Enqueue\Null; use Interop\Queue\Destination; use Interop\Queue\Message; diff --git a/pkg/null/NullQueue.php b/pkg/null/NullQueue.php index fef315d39..543111e67 100644 --- a/pkg/null/NullQueue.php +++ b/pkg/null/NullQueue.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\NoEffect; +namespace Enqueue\Null; use Interop\Queue\Queue; diff --git a/pkg/null/NullSubscriptionConsumer.php b/pkg/null/NullSubscriptionConsumer.php index bd8896566..1e9591666 100644 --- a/pkg/null/NullSubscriptionConsumer.php +++ b/pkg/null/NullSubscriptionConsumer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Enqueue\NoEffect; +namespace Enqueue\Null; use Interop\Queue\Consumer; use Interop\Queue\SubscriptionConsumer; diff --git a/pkg/null/NullTopic.php b/pkg/null/NullTopic.php index 54351bc8e..9c86ad076 100644 --- a/pkg/null/NullTopic.php +++ b/pkg/null/NullTopic.php @@ -1,6 +1,6 @@ Date: Mon, 30 May 2022 09:13:04 +0200 Subject: [PATCH 6/6] refactor(require): use noeffect instead of null --- pkg/amqp-bunny/composer.json | 2 +- pkg/amqp-ext/composer.json | 2 +- pkg/amqp-lib/composer.json | 2 +- pkg/amqp-tools/composer.json | 2 +- pkg/async-command/composer.json | 2 +- pkg/async-event-dispatcher/composer.json | 2 +- pkg/dbal/composer.json | 2 +- pkg/fs/composer.json | 2 +- pkg/gearman/composer.json | 2 +- pkg/mongodb/composer.json | 2 +- pkg/pheanstalk/composer.json | 2 +- pkg/rdkafka/composer.json | 2 +- pkg/redis/composer.json | 2 +- pkg/simple-client/composer.json | 2 +- pkg/stomp/composer.json | 2 +- pkg/wamp/composer.json | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pkg/amqp-bunny/composer.json b/pkg/amqp-bunny/composer.json index 6efe7ee84..d38967a24 100644 --- a/pkg/amqp-bunny/composer.json +++ b/pkg/amqp-bunny/composer.json @@ -15,7 +15,7 @@ "require-dev": { "phpunit/phpunit": "^9.5", "enqueue/test": "0.10.x-dev", - "enqueue/null": "0.10.x-dev", + "enqueue/noeffect": "0.10.x-dev", "queue-interop/queue-spec": "^0.6.2" }, "support": { diff --git a/pkg/amqp-ext/composer.json b/pkg/amqp-ext/composer.json index 91c572a25..ffe4ea54f 100644 --- a/pkg/amqp-ext/composer.json +++ b/pkg/amqp-ext/composer.json @@ -15,7 +15,7 @@ "require-dev": { "phpunit/phpunit": "^9.5", "enqueue/test": "0.10.x-dev", - "enqueue/null": "0.10.x-dev", + "enqueue/noeffect": "0.10.x-dev", "queue-interop/queue-spec": "^0.6.2", "empi89/php-amqp-stubs": "*@dev" }, diff --git a/pkg/amqp-lib/composer.json b/pkg/amqp-lib/composer.json index 9665a2cca..79e897a28 100644 --- a/pkg/amqp-lib/composer.json +++ b/pkg/amqp-lib/composer.json @@ -15,7 +15,7 @@ "require-dev": { "phpunit/phpunit": "^9.5", "enqueue/test": "0.10.x-dev", - "enqueue/null": "0.10.x-dev", + "enqueue/noeffect": "0.10.x-dev", "queue-interop/queue-spec": "^0.6.2" }, "support": { diff --git a/pkg/amqp-tools/composer.json b/pkg/amqp-tools/composer.json index ccc282006..3c1f0853a 100644 --- a/pkg/amqp-tools/composer.json +++ b/pkg/amqp-tools/composer.json @@ -14,7 +14,7 @@ "require-dev": { "phpunit/phpunit": "^9.5", "enqueue/test": "0.10.x-dev", - "enqueue/null": "0.10.x-dev" + "enqueue/noeffect": "0.10.x-dev" }, "support": { "email": "opensource@forma-pro.com", diff --git a/pkg/async-command/composer.json b/pkg/async-command/composer.json index 98b90ad83..93f240217 100644 --- a/pkg/async-command/composer.json +++ b/pkg/async-command/composer.json @@ -19,7 +19,7 @@ "symfony/http-kernel": "^5.1|^6.0", "symfony/filesystem": "^5.1|^6.0", "symfony/yaml": "^5.1|^6.0", - "enqueue/null": "0.10.x-dev", + "enqueue/noeffect": "0.10.x-dev", "enqueue/fs": "0.10.x-dev", "enqueue/test": "0.10.x-dev" }, diff --git a/pkg/async-event-dispatcher/composer.json b/pkg/async-event-dispatcher/composer.json index 3f124dc8f..1de417b3f 100644 --- a/pkg/async-event-dispatcher/composer.json +++ b/pkg/async-event-dispatcher/composer.json @@ -18,7 +18,7 @@ "symfony/http-kernel": "^5.1|^6.0", "symfony/filesystem": "^5.1|^6.0", "symfony/yaml": "^5.1|^6.0", - "enqueue/null": "0.10.x-dev", + "enqueue/noeffect": "0.10.x-dev", "enqueue/fs": "0.10.x-dev", "enqueue/test": "0.10.x-dev" }, diff --git a/pkg/dbal/composer.json b/pkg/dbal/composer.json index 950387387..d0770cf25 100644 --- a/pkg/dbal/composer.json +++ b/pkg/dbal/composer.json @@ -15,7 +15,7 @@ "require-dev": { "phpunit/phpunit": "^9.5", "enqueue/test": "0.10.x-dev", - "enqueue/null": "0.10.x-dev", + "enqueue/noeffect": "0.10.x-dev", "queue-interop/queue-spec": "^0.6.2" }, "support": { diff --git a/pkg/fs/composer.json b/pkg/fs/composer.json index e22929097..5e366d568 100644 --- a/pkg/fs/composer.json +++ b/pkg/fs/composer.json @@ -14,7 +14,7 @@ }, "require-dev": { "phpunit/phpunit": "^9.5", - "enqueue/null": "0.10.x-dev", + "enqueue/noeffect": "0.10.x-dev", "enqueue/test": "0.10.x-dev", "queue-interop/queue-spec": "^0.6.2", "symfony/dependency-injection": "^5.1|^6.0", diff --git a/pkg/gearman/composer.json b/pkg/gearman/composer.json index 4dfdb3781..bc0508dbf 100644 --- a/pkg/gearman/composer.json +++ b/pkg/gearman/composer.json @@ -13,7 +13,7 @@ "require-dev": { "phpunit/phpunit": "^9.5", "enqueue/test": "0.10.x-dev", - "enqueue/null": "0.10.x-dev", + "enqueue/noeffect": "0.10.x-dev", "queue-interop/queue-spec": "^0.6.2" }, "support": { diff --git a/pkg/mongodb/composer.json b/pkg/mongodb/composer.json index 8089c1a4f..addbab84f 100644 --- a/pkg/mongodb/composer.json +++ b/pkg/mongodb/composer.json @@ -19,7 +19,7 @@ "phpunit/phpunit": "^9.5", "queue-interop/queue-spec": "^0.6.2", "enqueue/test": "0.10.x-dev", - "enqueue/null": "0.10.x-dev" + "enqueue/noeffect": "0.10.x-dev" }, "support": { "email": "opensource@forma-pro.com", diff --git a/pkg/pheanstalk/composer.json b/pkg/pheanstalk/composer.json index bb019e2d9..fb7900ce0 100644 --- a/pkg/pheanstalk/composer.json +++ b/pkg/pheanstalk/composer.json @@ -13,7 +13,7 @@ "require-dev": { "phpunit/phpunit": "^9.5", "enqueue/test": "0.10.x-dev", - "enqueue/null": "0.10.x-dev", + "enqueue/noeffect": "0.10.x-dev", "queue-interop/queue-spec": "^0.6.2" }, "support": { diff --git a/pkg/rdkafka/composer.json b/pkg/rdkafka/composer.json index 2b5ec5541..82043fec9 100644 --- a/pkg/rdkafka/composer.json +++ b/pkg/rdkafka/composer.json @@ -13,7 +13,7 @@ "require-dev": { "phpunit/phpunit": "^9.5", "enqueue/test": "0.10.x-dev", - "enqueue/null": "0.10.x-dev", + "enqueue/noeffect": "0.10.x-dev", "queue-interop/queue-spec": "^0.6.2", "kwn/php-rdkafka-stubs": "^2.0.3" }, diff --git a/pkg/redis/composer.json b/pkg/redis/composer.json index 4fd68f139..c624971d1 100644 --- a/pkg/redis/composer.json +++ b/pkg/redis/composer.json @@ -15,7 +15,7 @@ "phpunit/phpunit": "^9.5", "predis/predis": "^1.1", "enqueue/test": "0.10.x-dev", - "enqueue/null": "0.10.x-dev", + "enqueue/noeffect": "0.10.x-dev", "queue-interop/queue-spec": "^0.6.2" }, "support": { diff --git a/pkg/simple-client/composer.json b/pkg/simple-client/composer.json index f12215eac..7723b6e3d 100644 --- a/pkg/simple-client/composer.json +++ b/pkg/simple-client/composer.json @@ -17,7 +17,7 @@ "enqueue/test": "0.10.x-dev", "enqueue/amqp-ext": "0.10.x-dev", "enqueue/fs": "0.10.x-dev", - "enqueue/null": "0.10.x-dev", + "enqueue/noeffect": "0.10.x-dev", "symfony/yaml": "^5.1|^6.0" }, "support": { diff --git a/pkg/stomp/composer.json b/pkg/stomp/composer.json index 383ce6fe9..09b1d959a 100644 --- a/pkg/stomp/composer.json +++ b/pkg/stomp/composer.json @@ -19,7 +19,7 @@ "require-dev": { "phpunit/phpunit": "^9.5", "enqueue/test": "0.10.x-dev", - "enqueue/null": "0.10.x-dev", + "enqueue/noeffect": "0.10.x-dev", "queue-interop/queue-spec": "^0.6.2" }, "support": { diff --git a/pkg/wamp/composer.json b/pkg/wamp/composer.json index 89bdbf315..7180388a0 100644 --- a/pkg/wamp/composer.json +++ b/pkg/wamp/composer.json @@ -19,7 +19,7 @@ "require-dev": { "phpunit/phpunit": "^9.5", "enqueue/test": "0.10.x-dev", - "enqueue/null": "0.10.x-dev", + "enqueue/noeffect": "0.10.x-dev", "queue-interop/queue-spec": "^0.6.2" }, "support": {