diff --git a/composer.json b/composer.json index d4aa772c4..38262420b 100644 --- a/composer.json +++ b/composer.json @@ -88,6 +88,7 @@ "Enqueue\\Gps\\": "pkg/gps/", "Enqueue\\JobQueue\\": "pkg/job-queue/", "Enqueue\\Mongodb\\": "pkg/mongodb/", + "Enqueue\\NoEffect\\": "pkg/noeffect/", "Enqueue\\Null\\": "pkg/null/", "Enqueue\\Pheanstalk\\": "pkg/pheanstalk/", "Enqueue\\RdKafka\\": "pkg/rdkafka/", 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-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/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/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/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-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/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/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/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/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/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/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/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/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/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 @@ +