From ecd1f6b8e6dbcba5f3a31f6f9d934594323a7af7 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Thu, 12 Oct 2017 14:26:29 +0300 Subject: [PATCH 01/45] upd queue spec req --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f74a00f..e24c54c 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "phpunit/phpunit": "~5.5", "enqueue/enqueue": "^0.8@dev", "enqueue/test": "^0.8@dev", - "queue-interop/queue-spec": "^0.5@dev", + "queue-interop/queue-spec": "^0.5.3@dev", "symfony/dependency-injection": "^2.8|^3", "symfony/config": "^2.8|^3" }, From 60333c144b9b85efa455cbe29b7e67b3cf4943ad Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Wed, 15 Nov 2017 15:36:43 +0200 Subject: [PATCH 02/45] add homepage link to composer.json --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index e24c54c..4bc6d4f 100644 --- a/composer.json +++ b/composer.json @@ -3,6 +3,7 @@ "type": "library", "description": "Enqueue Null transport", "keywords": ["messaging", "queue", "testing"], + "homepage": "https://github.com/php-enqueue/enqueue-dev", "license": "MIT", "require": { "php": ">=5.6", From 3768c74a8d763897eebdb0534ed94dca260835b3 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Wed, 15 Nov 2017 12:18:06 +0200 Subject: [PATCH 03/45] Add Symfony4 support. --- Symfony/NullTransportFactory.php | 3 +++ composer.json | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Symfony/NullTransportFactory.php b/Symfony/NullTransportFactory.php index 2784405..7d70b84 100644 --- a/Symfony/NullTransportFactory.php +++ b/Symfony/NullTransportFactory.php @@ -66,7 +66,9 @@ public function createContext(ContainerBuilder $container, array $config) $factoryId = sprintf('enqueue.transport.%s.connection_factory', $this->getName()); $contextId = sprintf('enqueue.transport.%s.context', $this->getName()); + $context = new Definition(NullContext::class); + $context->setPublic(true); $context->setFactory([new Reference($factoryId), 'createContext']); $container->setDefinition($contextId, $context); @@ -80,6 +82,7 @@ public function createContext(ContainerBuilder $container, array $config) public function createDriver(ContainerBuilder $container, array $config) { $driver = new Definition(NullDriver::class); + $driver->setPublic(true); $driver->setArguments([ new Reference(sprintf('enqueue.transport.%s.context', $this->getName())), new Reference('enqueue.client.config'), diff --git a/composer.json b/composer.json index 4bc6d4f..e100496 100644 --- a/composer.json +++ b/composer.json @@ -14,8 +14,8 @@ "enqueue/enqueue": "^0.8@dev", "enqueue/test": "^0.8@dev", "queue-interop/queue-spec": "^0.5.3@dev", - "symfony/dependency-injection": "^2.8|^3", - "symfony/config": "^2.8|^3" + "symfony/dependency-injection": "^2.8|^3|^4", + "symfony/config": "^2.8|^3|^4" }, "autoload": { "psr-4": { "Enqueue\\Null\\": "" }, From 14b24186db831bef6f7dec627e98921dc08ba9ed Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Thu, 14 Dec 2017 14:20:06 +0200 Subject: [PATCH 04/45] [composer] add support section. fixes https://github.com/php-enqueue/enqueue-dev/issues/288 --- composer.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/composer.json b/composer.json index e100496..6919bda 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,13 @@ "symfony/dependency-injection": "^2.8|^3|^4", "symfony/config": "^2.8|^3|^4" }, + "support": { + "email": "opensource@forma-pro.com", + "issues": "https://github.com/php-enqueue/enqueue-dev/issues", + "forum": "https://gitter.im/php-enqueue/Lobby", + "source": "https://github.com/php-enqueue/enqueue-dev", + "docs": "https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md" + }, "autoload": { "psr-4": { "Enqueue\\Null\\": "" }, "exclude-from-classmap": [ From ad8f47e0787ee05527473c75909871cee0908d28 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Thu, 4 Jan 2018 11:46:31 +0200 Subject: [PATCH 05/45] Add link to site. --- README.md | 1 + composer.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ae7040e..bebd312 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ This is an implementation of PSR queue specification. It does not send messages ## Resources +* [Site](https://enqueue.forma-pro.com/) * [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md) * [Questions](https://gitter.im/php-enqueue/Lobby) * [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues) diff --git a/composer.json b/composer.json index 6919bda..94c956a 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "type": "library", "description": "Enqueue Null transport", "keywords": ["messaging", "queue", "testing"], - "homepage": "https://github.com/php-enqueue/enqueue-dev", + "homepage": "https://enqueue.forma-pro.com/", "license": "MIT", "require": { "php": ">=5.6", From 8f3ebfc8c18438315f1d2af188622592d9f6876c Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Wed, 17 Jan 2018 09:57:24 +0200 Subject: [PATCH 06/45] 0.9 --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 94c956a..228bd8f 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,8 @@ }, "require-dev": { "phpunit/phpunit": "~5.5", - "enqueue/enqueue": "^0.8@dev", - "enqueue/test": "^0.8@dev", + "enqueue/enqueue": "^0.9@dev", + "enqueue/test": "^0.9@dev", "queue-interop/queue-spec": "^0.5.3@dev", "symfony/dependency-injection": "^2.8|^3|^4", "symfony/config": "^2.8|^3|^4" @@ -33,7 +33,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "0.8.x-dev" + "dev-master": "0.9.x-dev" } } } From 1a254b7d00b55725bdb1f60dac4ec014d28e1ac6 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Fri, 16 Feb 2018 13:02:58 +0200 Subject: [PATCH 07/45] php cs fixes. --- NullMessage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NullMessage.php b/NullMessage.php index a2c019a..4e6a692 100644 --- a/NullMessage.php +++ b/NullMessage.php @@ -176,7 +176,7 @@ public function getTimestamp() { $value = $this->getHeader('timestamp'); - return $value === null ? null : (int) $value; + return null === $value ? null : (int) $value; } /** From 9339c4a5921cbe791da66ea1db0316174021a43b Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Tue, 6 Mar 2018 12:46:03 +0200 Subject: [PATCH 08/45] Allow queue interop 1.0 alpha. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 94c956a..d026149 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "license": "MIT", "require": { "php": ">=5.6", - "queue-interop/queue-interop": "^0.6@dev" + "queue-interop/queue-interop": "^0.6@dev|^1.0.0-alpha1" }, "require-dev": { "phpunit/phpunit": "~5.5", From e75270a99e6d65a2b7d739fa6c6131338d85acee Mon Sep 17 00:00:00 2001 From: Pascal Borreli Date: Fri, 23 Mar 2018 11:52:55 +0100 Subject: [PATCH 09/45] Fixed typos --- Tests/NullContextTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/NullContextTest.php b/Tests/NullContextTest.php index 921734c..a17f42a 100644 --- a/Tests/NullContextTest.php +++ b/Tests/NullContextTest.php @@ -90,7 +90,7 @@ public function testShouldAllowCreateProducer() $this->assertInstanceOf(NullProducer::class, $producer); } - public function testShouldCreateTempraryQueueWithUnqiueName() + public function testShouldCreateTemporaryQueueWithUniqueName() { $context = new NullContext(); From b38d1e457de9c2ae6ee03306abdb828b2c5c3e05 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Thu, 5 Apr 2018 10:25:20 +0300 Subject: [PATCH 10/45] Drop PHP5 support, Require Queue Interop with PHP7 features. --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 2b285db..33c8fff 100644 --- a/composer.json +++ b/composer.json @@ -6,8 +6,8 @@ "homepage": "https://enqueue.forma-pro.com/", "license": "MIT", "require": { - "php": ">=5.6", - "queue-interop/queue-interop": "^0.6@dev|^1.0.0-alpha1" + "php": "^7.1.3", + "queue-interop/queue-interop": "^0.7@dev" }, "require-dev": { "phpunit/phpunit": "~5.5", From 162a49610fc364b030b9659db03f4d2fe75ea06d Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Thu, 5 Apr 2018 10:30:01 +0300 Subject: [PATCH 11/45] Drop Symfony 2.x support, set Symfony 3.4 minimum supported version. --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 33c8fff..34a3783 100644 --- a/composer.json +++ b/composer.json @@ -14,8 +14,8 @@ "enqueue/enqueue": "^0.9@dev", "enqueue/test": "^0.9@dev", "queue-interop/queue-spec": "^0.5.3@dev", - "symfony/dependency-injection": "^2.8|^3|^4", - "symfony/config": "^2.8|^3|^4" + "symfony/dependency-injection": "^3.4|^4", + "symfony/config": "^3.4|^4" }, "support": { "email": "opensource@forma-pro.com", From 749a854f12cc4737bf9b4ce2e2c70fa354ac5a39 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Wed, 8 Aug 2018 12:34:35 +0300 Subject: [PATCH 12/45] 0.7@dev to 0.7.x-dev --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 34a3783..6b3babe 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "license": "MIT", "require": { "php": "^7.1.3", - "queue-interop/queue-interop": "^0.7@dev" + "queue-interop/queue-interop": "0.7.x-dev" }, "require-dev": { "phpunit/phpunit": "~5.5", From 80ef625364d4358360aad99ebf55bb970273b386 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Wed, 8 Aug 2018 17:32:42 +0300 Subject: [PATCH 13/45] fix req. --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 6b3babe..93f9570 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,8 @@ }, "require-dev": { "phpunit/phpunit": "~5.5", - "enqueue/enqueue": "^0.9@dev", - "enqueue/test": "^0.9@dev", + "enqueue/enqueue": "0.9.x-dev", + "enqueue/test": "0.9.x-dev", "queue-interop/queue-spec": "^0.5.3@dev", "symfony/dependency-injection": "^3.4|^4", "symfony/config": "^3.4|^4" From 04c3bc389db8c486d3aeddb5fdc882b5eb605640 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Thu, 9 Aug 2018 09:51:49 +0300 Subject: [PATCH 14/45] req queue interop ^0.6.2 and queue interop ^0.7.4 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 93f9570..5534460 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "license": "MIT", "require": { "php": "^7.1.3", - "queue-interop/queue-interop": "0.7.x-dev" + "queue-interop/queue-interop": "^0.6.2" }, "require-dev": { "phpunit/phpunit": "~5.5", From 2cdab2ba07be14f20f704dcee51d729865300e90 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Tue, 14 Aug 2018 10:38:52 +0300 Subject: [PATCH 15/45] update pkgs travis files. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b9cf57f..9ed4fa1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,8 @@ git: language: php php: - - '5.6' - - '7.0' + - '7.1' + - '7.2' cache: directories: From 8b0c8255cca8a1c62f7c40ef6e10c89bd982707f Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Tue, 21 Aug 2018 16:39:42 +0300 Subject: [PATCH 16/45] Migrate null transport. --- NullConnectionFactory.php | 5 +- NullConsumer.php | 27 +++------- NullContext.php | 43 ++++++++------- NullMessage.php | 102 ++++++++--------------------------- NullProducer.php | 32 ++++------- NullQueue.php | 10 +--- NullSubscriptionConsumer.php | 25 +++++++++ NullTopic.php | 10 +--- Tests/NullContextTest.php | 2 +- composer.json | 2 +- 10 files changed, 98 insertions(+), 160 deletions(-) create mode 100644 NullSubscriptionConsumer.php diff --git a/NullConnectionFactory.php b/NullConnectionFactory.php index 3e58fea..e8c500f 100644 --- a/NullConnectionFactory.php +++ b/NullConnectionFactory.php @@ -3,13 +3,14 @@ namespace Enqueue\Null; use Interop\Queue\PsrConnectionFactory; +use Interop\Queue\PsrContext; class NullConnectionFactory implements PsrConnectionFactory { /** - * {@inheritdoc} + * @return NullContext */ - public function createContext() + public function createContext(): PsrContext { return new NullContext(); } diff --git a/NullConsumer.php b/NullConsumer.php index 7c4e4fb..166cd38 100644 --- a/NullConsumer.php +++ b/NullConsumer.php @@ -5,6 +5,7 @@ use Interop\Queue\PsrConsumer; use Interop\Queue\PsrDestination; use Interop\Queue\PsrMessage; +use Interop\Queue\PsrQueue; class NullConsumer implements PsrConsumer { @@ -13,49 +14,37 @@ class NullConsumer implements PsrConsumer */ private $queue; - /** - * @param PsrDestination $queue - */ public function __construct(PsrDestination $queue) { $this->queue = $queue; } - /** - * {@inheritdoc} - */ - public function getQueue() + public function getQueue(): PsrQueue { return $this->queue; } /** - * {@inheritdoc} + * @return NullMessage */ - public function receive($timeout = 0) + public function receive(int $timeout = 0): ?PsrMessage { return null; } /** - * {@inheritdoc} + * @return NullMessage */ - public function receiveNoWait() + public function receiveNoWait(): ?PsrMessage { return null; } - /** - * {@inheritdoc} - */ - public function acknowledge(PsrMessage $message) + public function acknowledge(PsrMessage $message): void { } - /** - * {@inheritdoc} - */ - public function reject(PsrMessage $message, $requeue = false) + public function reject(PsrMessage $message, bool $requeue = false): void { } } diff --git a/NullContext.php b/NullContext.php index 2d2f48c..71a11c8 100644 --- a/NullContext.php +++ b/NullContext.php @@ -2,17 +2,21 @@ namespace Enqueue\Null; +use Interop\Queue\PsrConsumer; use Interop\Queue\PsrContext; use Interop\Queue\PsrDestination; +use Interop\Queue\PsrMessage; +use Interop\Queue\PsrProducer; +use Interop\Queue\PsrQueue; +use Interop\Queue\PsrSubscriptionConsumer; +use Interop\Queue\PsrTopic; class NullContext implements PsrContext { /** - * {@inheritdoc} - * * @return NullMessage */ - public function createMessage($body = null, array $properties = [], array $headers = []) + public function createMessage(string $body = '', array $properties = [], array $headers = []): PsrMessage { $message = new NullMessage(); $message->setBody($body); @@ -23,55 +27,58 @@ public function createMessage($body = null, array $properties = [], array $heade } /** - * {@inheritdoc} - * * @return NullQueue */ - public function createQueue($name) + public function createQueue(string $name): PsrQueue { return new NullQueue($name); } /** - * {@inheritdoc} + * @return NullQueue */ - public function createTemporaryQueue() + public function createTemporaryQueue(): PsrQueue { return $this->createQueue(uniqid('', true)); } /** - * {@inheritdoc} - * * @return NullTopic */ - public function createTopic($name) + public function createTopic(string $name): PsrTopic { return new NullTopic($name); } /** - * {@inheritdoc} - * * @return NullConsumer */ - public function createConsumer(PsrDestination $destination) + public function createConsumer(PsrDestination $destination): PsrConsumer { return new NullConsumer($destination); } /** - * {@inheritdoc} + * @return NullProducer */ - public function createProducer() + public function createProducer(): PsrProducer { return new NullProducer(); } /** - * {@inheritdoc} + * @return NullSubscriptionConsumer */ - public function close() + public function createSubscriptionConsumer(): PsrSubscriptionConsumer + { + return new NullSubscriptionConsumer(); + } + + public function purgeQueue(PsrQueue $queue): void + { + } + + public function close(): void { } } diff --git a/NullMessage.php b/NullMessage.php index 4e6a692..63fa05e 100644 --- a/NullMessage.php +++ b/NullMessage.php @@ -26,7 +26,7 @@ class NullMessage implements PsrMessage */ private $redelivered; - public function __construct($body = '', array $properties = [], array $headers = []) + public function __construct(string $body = '', array $properties = [], array $headers = []) { $this->body = $body; $this->properties = $properties; @@ -35,106 +35,67 @@ public function __construct($body = '', array $properties = [], array $headers = $this->redelivered = false; } - /** - * {@inheritdoc} - */ - public function setBody($body) + public function setBody(string $body): void { $this->body = $body; } - /** - * {@inheritdoc} - */ - public function getBody() + public function getBody(): string { return $this->body; } - /** - * {@inheritdoc} - */ - public function setProperties(array $properties) + public function setProperties(array $properties): void { $this->properties = $properties; } - /** - * {@inheritdoc} - */ - public function getProperties() + public function getProperties(): array { return $this->properties; } - /** - * {@inheritdoc} - */ - public function setProperty($name, $value) + public function setProperty(string $name, $value): void { $this->properties[$name] = $value; } - /** - * {@inheritdoc} - */ - public function getProperty($name, $default = null) + public function getProperty(string $name, $default = null) { return array_key_exists($name, $this->properties) ? $this->properties[$name] : $default; } - /** - * {@inheritdoc} - */ - public function setHeaders(array $headers) + public function setHeaders(array $headers): void { $this->headers = $headers; } - /** - * {@inheritdoc} - */ - public function getHeaders() + public function getHeaders(): array { return $this->headers; } - /** - * {@inheritdoc} - */ - public function setHeader($name, $value) + public function setHeader(string $name, $value): void { $this->headers[$name] = $value; } - /** - * {@inheritdoc} - */ - public function getHeader($name, $default = null) + public function getHeader(string $name, $default = null) { return array_key_exists($name, $this->headers) ? $this->headers[$name] : $default; } - /** - * {@inheritdoc} - */ - public function isRedelivered() + public function isRedelivered(): bool { return $this->redelivered; } - /** - * {@inheritdoc} - */ - public function setRedelivered($redelivered) + public function setRedelivered(bool $redelivered): void { $this->redelivered = $redelivered; } - /** - * {@inheritdoc} - */ - public function setCorrelationId($correlationId) + public function setCorrelationId(string $correlationId = null): void { $headers = $this->getHeaders(); $headers['correlation_id'] = (string) $correlationId; @@ -142,18 +103,12 @@ public function setCorrelationId($correlationId) $this->setHeaders($headers); } - /** - * {@inheritdoc} - */ - public function getCorrelationId() + public function getCorrelationId(): ?string { return $this->getHeader('correlation_id'); } - /** - * {@inheritdoc} - */ - public function setMessageId($messageId) + public function setMessageId(string $messageId = null): void { $headers = $this->getHeaders(); $headers['message_id'] = (string) $messageId; @@ -161,28 +116,19 @@ public function setMessageId($messageId) $this->setHeaders($headers); } - /** - * {@inheritdoc} - */ - public function getMessageId() + public function getMessageId(): ?string { return $this->getHeader('message_id'); } - /** - * {@inheritdoc} - */ - public function getTimestamp() + public function getTimestamp(): ?int { $value = $this->getHeader('timestamp'); return null === $value ? null : (int) $value; } - /** - * {@inheritdoc} - */ - public function setTimestamp($timestamp) + public function setTimestamp(int $timestamp = null): void { $headers = $this->getHeaders(); $headers['timestamp'] = (int) $timestamp; @@ -190,18 +136,12 @@ public function setTimestamp($timestamp) $this->setHeaders($headers); } - /** - * @param string|null $replyTo - */ - public function setReplyTo($replyTo) + public function setReplyTo(string $replyTo = null): void { $this->setHeader('reply_to', $replyTo); } - /** - * @return string|null - */ - public function getReplyTo() + public function getReplyTo(): ?string { return $this->getHeader('reply_to'); } diff --git a/NullProducer.php b/NullProducer.php index 47169a6..923e750 100644 --- a/NullProducer.php +++ b/NullProducer.php @@ -14,63 +14,51 @@ class NullProducer implements PsrProducer private $deliveryDelay; - /** - * {@inheritdoc} - */ - public function send(PsrDestination $destination, PsrMessage $message) + public function send(PsrDestination $destination, PsrMessage $message): void { } /** - * {@inheritdoc} + * @return NullProducer */ - public function setDeliveryDelay($deliveryDelay) + public function setDeliveryDelay(int $deliveryDelay = null): PsrProducer { $this->deliveryDelay = $deliveryDelay; return $this; } - /** - * {@inheritdoc} - */ - public function getDeliveryDelay() + public function getDeliveryDelay(): ?int { return $this->deliveryDelay; } /** - * {@inheritdoc} + * @return NullProducer */ - public function setPriority($priority) + public function setPriority(int $priority = null): PsrProducer { $this->priority = $priority; return $this; } - /** - * {@inheritdoc} - */ - public function getPriority() + public function getPriority(): ?int { return $this->priority; } /** - * {@inheritdoc} + * @return NullProducer */ - public function setTimeToLive($timeToLive) + public function setTimeToLive(int $timeToLive = null): PsrProducer { $this->timeToLive = $timeToLive; return $this; } - /** - * {@inheritdoc} - */ - public function getTimeToLive() + public function getTimeToLive(): ?int { return $this->timeToLive; } diff --git a/NullQueue.php b/NullQueue.php index d99e010..4449f1d 100644 --- a/NullQueue.php +++ b/NullQueue.php @@ -11,18 +11,12 @@ class NullQueue implements PsrQueue */ private $name; - /** - * @param string $name - */ - public function __construct($name) + public function __construct(string $name) { $this->name = $name; } - /** - * @return string - */ - public function getQueueName() + public function getQueueName(): string { return $this->name; } diff --git a/NullSubscriptionConsumer.php b/NullSubscriptionConsumer.php new file mode 100644 index 0000000..263d4bd --- /dev/null +++ b/NullSubscriptionConsumer.php @@ -0,0 +1,25 @@ +name = $name; } - /** - * @return string - */ - public function getTopicName() + public function getTopicName(): string { return $this->name; } diff --git a/Tests/NullContextTest.php b/Tests/NullContextTest.php index a17f42a..1a4c90c 100644 --- a/Tests/NullContextTest.php +++ b/Tests/NullContextTest.php @@ -34,7 +34,7 @@ public function testShouldAllowCreateMessageWithoutAnyArguments() $this->assertInstanceOf(NullMessage::class, $message); - $this->assertNull($message->getBody()); + $this->assertSame('', $message->getBody()); $this->assertSame([], $message->getHeaders()); $this->assertSame([], $message->getProperties()); } diff --git a/composer.json b/composer.json index 5534460..93f9570 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "license": "MIT", "require": { "php": "^7.1.3", - "queue-interop/queue-interop": "^0.6.2" + "queue-interop/queue-interop": "0.7.x-dev" }, "require-dev": { "phpunit/phpunit": "~5.5", From 0360702a05dd11f87ff7554c3896ae0a48c0a83a Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Wed, 22 Aug 2018 15:58:01 +0300 Subject: [PATCH 17/45] upd spec version. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 93f9570..22c58b8 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "phpunit/phpunit": "~5.5", "enqueue/enqueue": "0.9.x-dev", "enqueue/test": "0.9.x-dev", - "queue-interop/queue-spec": "^0.5.3@dev", + "queue-interop/queue-spec": "0.6.x-dev", "symfony/dependency-injection": "^3.4|^4", "symfony/config": "^3.4|^4" }, From b4c97761e5ce4ef9cf03d82eb33ebd33c3b2ff70 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Sat, 25 Aug 2018 20:17:58 +0300 Subject: [PATCH 18/45] add strict to mongodb, null, and pheanstalk transports. --- NullConnectionFactory.php | 2 ++ NullConsumer.php | 2 ++ NullContext.php | 2 ++ NullMessage.php | 2 ++ NullProducer.php | 2 ++ NullQueue.php | 2 ++ NullSubscriptionConsumer.php | 2 ++ 7 files changed, 14 insertions(+) diff --git a/NullConnectionFactory.php b/NullConnectionFactory.php index e8c500f..fd9c1c5 100644 --- a/NullConnectionFactory.php +++ b/NullConnectionFactory.php @@ -1,5 +1,7 @@ Date: Tue, 4 Sep 2018 17:59:00 +0300 Subject: [PATCH 19/45] Simplify Enqueue configuration. --- Client/NullDriver.php | 160 ------------ Symfony/NullTransportFactory.php | 105 -------- Tests/Client/NullDriverTest.php | 277 --------------------- Tests/Symfony/NullTransportFactoryTest.php | 136 ---------- composer.json | 5 +- 5 files changed, 1 insertion(+), 682 deletions(-) delete mode 100644 Client/NullDriver.php delete mode 100644 Symfony/NullTransportFactory.php delete mode 100644 Tests/Client/NullDriverTest.php delete mode 100644 Tests/Symfony/NullTransportFactoryTest.php diff --git a/Client/NullDriver.php b/Client/NullDriver.php deleted file mode 100644 index 156cea2..0000000 --- a/Client/NullDriver.php +++ /dev/null @@ -1,160 +0,0 @@ -context = $context; - $this->config = $config; - $this->queueMetaRegistry = $queueMetaRegistry; - } - - /** - * {@inheritdoc} - * - * @return NullMessage - */ - public function createTransportMessage(Message $message) - { - $headers = $message->getHeaders(); - $headers['content_type'] = $message->getContentType(); - $headers['expiration'] = $message->getExpire(); - $headers['delay'] = $message->getDelay(); - $headers['priority'] = $message->getPriority(); - - $transportMessage = $this->context->createMessage(); - $transportMessage->setBody($message->getBody()); - $transportMessage->setHeaders($headers); - $transportMessage->setProperties($message->getProperties()); - $transportMessage->setTimestamp($message->getTimestamp()); - $transportMessage->setMessageId($message->getMessageId()); - $transportMessage->setReplyTo($message->getReplyTo()); - $transportMessage->setCorrelationId($message->getCorrelationId()); - - return $transportMessage; - } - - /** - * {@inheritdoc} - * - * @param NullMessage $message - */ - public function createClientMessage(PsrMessage $message) - { - $clientMessage = new Message(); - $clientMessage->setBody($message->getBody()); - $clientMessage->setHeaders($message->getHeaders()); - $clientMessage->setProperties($message->getProperties()); - $clientMessage->setTimestamp($message->getTimestamp()); - $clientMessage->setMessageId($message->getMessageId()); - $clientMessage->setReplyTo($message->getReplyTo()); - $clientMessage->setCorrelationId($message->getCorrelationId()); - - if ($contentType = $message->getHeader('content_type')) { - $clientMessage->setContentType($contentType); - } - - if ($expiration = $message->getHeader('expiration')) { - $clientMessage->setExpire($expiration); - } - - if ($delay = $message->getHeader('delay')) { - $clientMessage->setDelay($delay); - } - - if ($priority = $message->getHeader('priority')) { - $clientMessage->setPriority($priority); - } - - return $clientMessage; - } - - /** - * {@inheritdoc} - */ - public function createQueue($queueName) - { - $transportName = $this->queueMetaRegistry->getQueueMeta($queueName)->getTransportName(); - - return $this->context->createQueue($transportName); - } - - /** - * {@inheritdoc} - */ - public function getConfig() - { - return $this->config; - } - - /** - * {@inheritdoc} - */ - public function sendToRouter(Message $message) - { - $transportMessage = $this->createTransportMessage($message); - $topic = $this->context->createTopic( - $this->config->createTransportRouterTopicName( - $this->config->getRouterTopicName() - ) - ); - - $this->context->createProducer()->send($topic, $transportMessage); - } - - /** - * {@inheritdoc} - */ - public function sendToProcessor(Message $message) - { - $transportMessage = $this->createTransportMessage($message); - $queue = $this->context->createQueue( - $this->config->createTransportQueueName( - $this->config->getRouterQueueName() - ) - ); - - $this->context->createProducer()->send($queue, $transportMessage); - } - - /** - * {@inheritdoc} - */ - public function setupBroker(LoggerInterface $logger = null) - { - $logger ?: new NullLogger(); - $logger->debug('[NullDriver] setup broker'); - } -} diff --git a/Symfony/NullTransportFactory.php b/Symfony/NullTransportFactory.php deleted file mode 100644 index 7d70b84..0000000 --- a/Symfony/NullTransportFactory.php +++ /dev/null @@ -1,105 +0,0 @@ -name = $name; - } - - /** - * {@inheritdoc} - */ - public function addConfiguration(ArrayNodeDefinition $builder) - { - $builder - ->beforeNormalization() - ->ifString()->then(function ($v) { - return ['dsn' => $v]; - }) - ->end() - ->children() - ->scalarNode('dsn')->end() - ->end() - ; - } - - /** - * {@inheritdoc} - */ - public function createConnectionFactory(ContainerBuilder $container, array $config) - { - $factoryId = sprintf('enqueue.transport.%s.connection_factory', $this->getName()); - - $factory = new Definition(NullConnectionFactory::class); - - $container->setDefinition($factoryId, $factory); - - return $factoryId; - } - - /** - * {@inheritdoc} - */ - public function createContext(ContainerBuilder $container, array $config) - { - $factoryId = sprintf('enqueue.transport.%s.connection_factory', $this->getName()); - - $contextId = sprintf('enqueue.transport.%s.context', $this->getName()); - - $context = new Definition(NullContext::class); - $context->setPublic(true); - $context->setFactory([new Reference($factoryId), 'createContext']); - - $container->setDefinition($contextId, $context); - - return $contextId; - } - - /** - * {@inheritdoc} - */ - public function createDriver(ContainerBuilder $container, array $config) - { - $driver = new Definition(NullDriver::class); - $driver->setPublic(true); - $driver->setArguments([ - new Reference(sprintf('enqueue.transport.%s.context', $this->getName())), - new Reference('enqueue.client.config'), - new Reference('enqueue.client.meta.queue_meta_registry'), - ]); - - $driverId = sprintf('enqueue.client.%s.driver', $this->getName()); - $container->setDefinition($driverId, $driver); - - return $driverId; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } -} diff --git a/Tests/Client/NullDriverTest.php b/Tests/Client/NullDriverTest.php deleted file mode 100644 index c233b1a..0000000 --- a/Tests/Client/NullDriverTest.php +++ /dev/null @@ -1,277 +0,0 @@ -createDummyQueueMetaRegistry()); - } - - public function testShouldCreateAndReturnQueueInstance() - { - $expectedQueue = new NullQueue('aName'); - - $context = $this->createPsrContextMock(); - $context - ->expects($this->once()) - ->method('createQueue') - ->with('aprefix.afooqueue') - ->willReturn($expectedQueue) - ; - - $driver = new NullDriver($context, $this->createDummyConfig(), $this->createDummyQueueMetaRegistry()); - - $queue = $driver->createQueue('aFooQueue'); - - $this->assertSame($expectedQueue, $queue); - } - - public function testShouldCreateAndReturnQueueInstanceWithHardcodedTransportName() - { - $expectedQueue = new NullQueue('aName'); - - $context = $this->createPsrContextMock(); - $context - ->expects($this->once()) - ->method('createQueue') - ->with('aBarQueue') - ->willReturn($expectedQueue) - ; - - $driver = new NullDriver($context, $this->createDummyConfig(), $this->createDummyQueueMetaRegistry()); - - $queue = $driver->createQueue('aBarQueue'); - - $this->assertSame($expectedQueue, $queue); - } - - public function testShouldSendMessageToRouter() - { - $config = Config::create(); - $topic = new NullTopic('topic'); - - $transportMessage = new NullMessage(); - - $producer = $this->createMessageProducer(); - $producer - ->expects(self::once()) - ->method('send') - ->with(self::identicalTo($topic), self::identicalTo($transportMessage)) - ; - - $context = $this->createPsrContextMock(); - $context - ->expects($this->once()) - ->method('createTopic') - ->willReturn($topic) - ; - $context - ->expects($this->once()) - ->method('createMessage') - ->willReturn($transportMessage) - ; - $context - ->expects($this->once()) - ->method('createProducer') - ->willReturn($producer) - ; - - $driver = new NullDriver($context, $config, $this->createDummyQueueMetaRegistry()); - - $driver->sendToRouter(new Message()); - } - - public function testShouldSendMessageToProcessor() - { - $config = Config::create(); - $queue = new NullQueue(''); - - $transportMessage = new NullMessage(); - - $producer = $this->createMessageProducer(); - $producer - ->expects(self::once()) - ->method('send') - ->with(self::identicalTo($queue), self::identicalTo($transportMessage)) - ; - - $context = $this->createPsrContextMock(); - $context - ->expects($this->once()) - ->method('createQueue') - ->willReturn($queue) - ; - $context - ->expects($this->once()) - ->method('createMessage') - ->willReturn($transportMessage) - ; - $context - ->expects($this->once()) - ->method('createProducer') - ->willReturn($producer) - ; - - $driver = new NullDriver($context, $config, $this->createDummyQueueMetaRegistry()); - - $driver->sendToProcessor(new Message()); - } - - public function testShouldConvertClientMessageToTransportMessage() - { - $config = Config::create(); - - $clientMessage = new Message(); - $clientMessage->setBody('theBody'); - $clientMessage->setContentType('theContentType'); - $clientMessage->setMessageId('theMessageId'); - $clientMessage->setTimestamp(12345); - $clientMessage->setDelay(123); - $clientMessage->setExpire(345); - $clientMessage->setPriority(MessagePriority::LOW); - $clientMessage->setHeaders(['theHeaderFoo' => 'theFoo']); - $clientMessage->setProperties(['thePropertyBar' => 'theBar']); - $clientMessage->setReplyTo('theReplyTo'); - $clientMessage->setCorrelationId('theCorrelationId'); - - $transportMessage = new NullMessage(); - - $context = $this->createPsrContextMock(); - $context - ->expects($this->once()) - ->method('createMessage') - ->willReturn($transportMessage) - ; - - $driver = new NullDriver($context, $config, $this->createDummyQueueMetaRegistry()); - - $transportMessage = $driver->createTransportMessage($clientMessage); - - self::assertSame('theBody', $transportMessage->getBody()); - self::assertSame([ - 'theHeaderFoo' => 'theFoo', - 'content_type' => 'theContentType', - 'expiration' => 345, - 'delay' => 123, - 'priority' => MessagePriority::LOW, - 'timestamp' => 12345, - 'message_id' => 'theMessageId', - 'reply_to' => 'theReplyTo', - 'correlation_id' => 'theCorrelationId', - ], $transportMessage->getHeaders()); - self::assertSame([ - 'thePropertyBar' => 'theBar', - ], $transportMessage->getProperties()); - - $this->assertSame('theMessageId', $transportMessage->getMessageId()); - $this->assertSame(12345, $transportMessage->getTimestamp()); - $this->assertSame('theReplyTo', $transportMessage->getReplyTo()); - $this->assertSame('theCorrelationId', $transportMessage->getCorrelationId()); - } - - public function testShouldConvertTransportMessageToClientMessage() - { - $config = Config::create(); - - $transportMessage = new NullMessage(); - $transportMessage->setBody('theBody'); - $transportMessage->setHeaders(['theHeaderFoo' => 'theFoo']); - $transportMessage->setTimestamp(12345); - $transportMessage->setMessageId('theMessageId'); - $transportMessage->setHeader('priority', MessagePriority::LOW); - $transportMessage->setHeader('content_type', 'theContentType'); - $transportMessage->setHeader('delay', 123); - $transportMessage->setHeader('expiration', 345); - $transportMessage->setProperties(['thePropertyBar' => 'theBar']); - $transportMessage->setReplyTo('theReplyTo'); - $transportMessage->setCorrelationId('theCorrelationId'); - - $driver = new NullDriver($this->createPsrContextMock(), $config, $this->createDummyQueueMetaRegistry()); - - $clientMessage = $driver->createClientMessage($transportMessage); - - self::assertSame('theBody', $clientMessage->getBody()); - self::assertSame(MessagePriority::LOW, $clientMessage->getPriority()); - self::assertSame('theContentType', $clientMessage->getContentType()); - self::assertSame(123, $clientMessage->getDelay()); - self::assertSame(345, $clientMessage->getExpire()); - self::assertEquals([ - 'theHeaderFoo' => 'theFoo', - 'content_type' => 'theContentType', - 'expiration' => 345, - 'delay' => 123, - 'priority' => MessagePriority::LOW, - 'timestamp' => 12345, - 'message_id' => 'theMessageId', - 'reply_to' => 'theReplyTo', - 'correlation_id' => 'theCorrelationId', - ], $clientMessage->getHeaders()); - self::assertSame([ - 'thePropertyBar' => 'theBar', - ], $clientMessage->getProperties()); - - $this->assertSame('theReplyTo', $clientMessage->getReplyTo()); - $this->assertSame('theCorrelationId', $clientMessage->getCorrelationId()); - } - - public function testShouldReturnConfigInstance() - { - $config = Config::create(); - - $driver = new NullDriver($this->createPsrContextMock(), $config, $this->createDummyQueueMetaRegistry()); - $result = $driver->getConfig(); - - self::assertSame($config, $result); - } - - /** - * @return \PHPUnit_Framework_MockObject_MockObject|NullContext - */ - private function createPsrContextMock() - { - return $this->createMock(NullContext::class); - } - - /** - * @return \PHPUnit_Framework_MockObject_MockObject|NullProducer - */ - private function createMessageProducer() - { - return $this->createMock(NullProducer::class); - } - - /** - * @return QueueMetaRegistry - */ - private function createDummyQueueMetaRegistry() - { - $registry = new QueueMetaRegistry($this->createDummyConfig(), []); - $registry->add('default'); - $registry->add('aFooQueue'); - $registry->add('aBarQueue', 'aBarQueue'); - - return $registry; - } - - /** - * @return Config - */ - private function createDummyConfig() - { - return Config::create('aPrefix'); - } -} diff --git a/Tests/Symfony/NullTransportFactoryTest.php b/Tests/Symfony/NullTransportFactoryTest.php deleted file mode 100644 index b6c80f1..0000000 --- a/Tests/Symfony/NullTransportFactoryTest.php +++ /dev/null @@ -1,136 +0,0 @@ -assertClassImplements(TransportFactoryInterface::class, NullTransportFactory::class); - } - - public function testCouldBeConstructedWithDefaultName() - { - $transport = new NullTransportFactory(); - - $this->assertEquals('null', $transport->getName()); - } - - public function testCouldBeConstructedWithCustomName() - { - $transport = new NullTransportFactory('theCustomName'); - - $this->assertEquals('theCustomName', $transport->getName()); - } - - public function testShouldAllowAddConfiguration() - { - $transport = new NullTransportFactory(); - $tb = new TreeBuilder(); - $rootNode = $tb->root('foo'); - - $transport->addConfiguration($rootNode); - $processor = new Processor(); - $config = $processor->process($tb->buildTree(), [true]); - - $this->assertEquals([], $config); - } - - public function testShouldAllowAddConfigurationWithDsnString() - { - $transport = new NullTransportFactory(); - $tb = new TreeBuilder(); - $rootNode = $tb->root('foo'); - - $transport->addConfiguration($rootNode); - $processor = new Processor(); - $config = $processor->process($tb->buildTree(), ['aStringDSN']); - - $this->assertEquals(['dsn' => 'aStringDSN'], $config); - } - - public function testShouldAllowAddConfigurationWithDsnStringOption() - { - $transport = new NullTransportFactory(); - $tb = new TreeBuilder(); - $rootNode = $tb->root('foo'); - - $transport->addConfiguration($rootNode); - $processor = new Processor(); - $config = $processor->process($tb->buildTree(), [['dsn' => 'aStringDSN']]); - - $this->assertEquals(['dsn' => 'aStringDSN'], $config); - } - - public function testShouldCreateConnectionFactory() - { - $container = new ContainerBuilder(); - - $transport = new NullTransportFactory(); - - $serviceId = $transport->createConnectionFactory($container, []); - - $this->assertTrue($container->hasDefinition($serviceId)); - $factory = $container->getDefinition($serviceId); - $this->assertEquals(NullConnectionFactory::class, $factory->getClass()); - $this->assertSame([], $factory->getArguments()); - } - - public function testShouldCreateContext() - { - $container = new ContainerBuilder(); - - $transport = new NullTransportFactory(); - - $serviceId = $transport->createContext($container, []); - - $this->assertEquals('enqueue.transport.null.context', $serviceId); - $this->assertTrue($container->hasDefinition($serviceId)); - - $context = $container->getDefinition($serviceId); - $this->assertEquals(NullContext::class, $context->getClass()); - $this->assertEquals( - [new Reference('enqueue.transport.null.connection_factory'), 'createContext'], - $context->getFactory() - ); - } - - public function testShouldCreateDriver() - { - $container = new ContainerBuilder(); - - $transport = new NullTransportFactory(); - - $driverId = $transport->createDriver($container, []); - - $this->assertEquals('enqueue.client.null.driver', $driverId); - $this->assertTrue($container->hasDefinition($driverId)); - - $driver = $container->getDefinition($driverId); - $this->assertEquals(NullDriver::class, $driver->getClass()); - $this->assertNull($driver->getFactory()); - - $this->assertInstanceOf(Reference::class, $driver->getArgument(0)); - $this->assertEquals('enqueue.transport.null.context', (string) $driver->getArgument(0)); - - $this->assertInstanceOf(Reference::class, $driver->getArgument(1)); - $this->assertEquals('enqueue.client.config', (string) $driver->getArgument(1)); - - $this->assertInstanceOf(Reference::class, $driver->getArgument(2)); - $this->assertEquals('enqueue.client.meta.queue_meta_registry', (string) $driver->getArgument(2)); - } -} diff --git a/composer.json b/composer.json index 22c58b8..e174356 100644 --- a/composer.json +++ b/composer.json @@ -11,11 +11,8 @@ }, "require-dev": { "phpunit/phpunit": "~5.5", - "enqueue/enqueue": "0.9.x-dev", "enqueue/test": "0.9.x-dev", - "queue-interop/queue-spec": "0.6.x-dev", - "symfony/dependency-injection": "^3.4|^4", - "symfony/config": "^3.4|^4" + "queue-interop/queue-spec": "0.6.x-dev" }, "support": { "email": "opensource@forma-pro.com", From 163a147007298507d56eea47aa3d99dcc44ca179 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Fri, 28 Sep 2018 14:36:00 +0300 Subject: [PATCH 20/45] [null] Do not use deprecated classes. --- NullConnectionFactory.php | 8 +++---- NullConsumer.php | 24 ++++++++++---------- NullContext.php | 34 ++++++++++++++--------------- NullMessage.php | 4 ++-- NullProducer.php | 16 +++++++------- NullQueue.php | 4 ++-- NullSubscriptionConsumer.php | 10 ++++----- NullTopic.php | 4 ++-- README.md | 2 +- Tests/NullConnectionFactoryTest.php | 4 ++-- Tests/NullConsumerTest.php | 4 ++-- Tests/NullContextTest.php | 4 ++-- Tests/NullMessageTest.php | 4 ++-- Tests/NullProducerTest.php | 4 ++-- Tests/NullQueueTest.php | 4 ++-- Tests/NullTopicTest.php | 4 ++-- 16 files changed, 67 insertions(+), 67 deletions(-) diff --git a/NullConnectionFactory.php b/NullConnectionFactory.php index fd9c1c5..b89cd50 100644 --- a/NullConnectionFactory.php +++ b/NullConnectionFactory.php @@ -4,15 +4,15 @@ namespace Enqueue\Null; -use Interop\Queue\PsrConnectionFactory; -use Interop\Queue\PsrContext; +use Interop\Queue\ConnectionFactory; +use Interop\Queue\Context; -class NullConnectionFactory implements PsrConnectionFactory +class NullConnectionFactory implements ConnectionFactory { /** * @return NullContext */ - public function createContext(): PsrContext + public function createContext(): Context { return new NullContext(); } diff --git a/NullConsumer.php b/NullConsumer.php index 71bc74e..d9b2348 100644 --- a/NullConsumer.php +++ b/NullConsumer.php @@ -4,24 +4,24 @@ namespace Enqueue\Null; -use Interop\Queue\PsrConsumer; -use Interop\Queue\PsrDestination; -use Interop\Queue\PsrMessage; -use Interop\Queue\PsrQueue; +use Interop\Queue\Consumer; +use Interop\Queue\Destination; +use Interop\Queue\Message; +use Interop\Queue\Queue; -class NullConsumer implements PsrConsumer +class NullConsumer implements Consumer { /** - * @var PsrDestination + * @var Destination */ private $queue; - public function __construct(PsrDestination $queue) + public function __construct(Destination $queue) { $this->queue = $queue; } - public function getQueue(): PsrQueue + public function getQueue(): Queue { return $this->queue; } @@ -29,7 +29,7 @@ public function getQueue(): PsrQueue /** * @return NullMessage */ - public function receive(int $timeout = 0): ?PsrMessage + public function receive(int $timeout = 0): ?Message { return null; } @@ -37,16 +37,16 @@ public function receive(int $timeout = 0): ?PsrMessage /** * @return NullMessage */ - public function receiveNoWait(): ?PsrMessage + public function receiveNoWait(): ?Message { return null; } - public function acknowledge(PsrMessage $message): void + public function acknowledge(Message $message): void { } - public function reject(PsrMessage $message, bool $requeue = false): void + public function reject(Message $message, bool $requeue = false): void { } } diff --git a/NullContext.php b/NullContext.php index d9bb812..5f6001c 100644 --- a/NullContext.php +++ b/NullContext.php @@ -4,21 +4,21 @@ namespace Enqueue\Null; -use Interop\Queue\PsrConsumer; -use Interop\Queue\PsrContext; -use Interop\Queue\PsrDestination; -use Interop\Queue\PsrMessage; -use Interop\Queue\PsrProducer; -use Interop\Queue\PsrQueue; -use Interop\Queue\PsrSubscriptionConsumer; -use Interop\Queue\PsrTopic; +use Interop\Queue\Consumer; +use Interop\Queue\Context; +use Interop\Queue\Destination; +use Interop\Queue\Message; +use Interop\Queue\Producer; +use Interop\Queue\Queue; +use Interop\Queue\SubscriptionConsumer; +use Interop\Queue\Topic; -class NullContext implements PsrContext +class NullContext implements Context { /** * @return NullMessage */ - public function createMessage(string $body = '', array $properties = [], array $headers = []): PsrMessage + public function createMessage(string $body = '', array $properties = [], array $headers = []): Message { $message = new NullMessage(); $message->setBody($body); @@ -31,7 +31,7 @@ public function createMessage(string $body = '', array $properties = [], array $ /** * @return NullQueue */ - public function createQueue(string $name): PsrQueue + public function createQueue(string $name): Queue { return new NullQueue($name); } @@ -39,7 +39,7 @@ public function createQueue(string $name): PsrQueue /** * @return NullQueue */ - public function createTemporaryQueue(): PsrQueue + public function createTemporaryQueue(): Queue { return $this->createQueue(uniqid('', true)); } @@ -47,7 +47,7 @@ public function createTemporaryQueue(): PsrQueue /** * @return NullTopic */ - public function createTopic(string $name): PsrTopic + public function createTopic(string $name): Topic { return new NullTopic($name); } @@ -55,7 +55,7 @@ public function createTopic(string $name): PsrTopic /** * @return NullConsumer */ - public function createConsumer(PsrDestination $destination): PsrConsumer + public function createConsumer(Destination $destination): Consumer { return new NullConsumer($destination); } @@ -63,7 +63,7 @@ public function createConsumer(PsrDestination $destination): PsrConsumer /** * @return NullProducer */ - public function createProducer(): PsrProducer + public function createProducer(): Producer { return new NullProducer(); } @@ -71,12 +71,12 @@ public function createProducer(): PsrProducer /** * @return NullSubscriptionConsumer */ - public function createSubscriptionConsumer(): PsrSubscriptionConsumer + public function createSubscriptionConsumer(): SubscriptionConsumer { return new NullSubscriptionConsumer(); } - public function purgeQueue(PsrQueue $queue): void + public function purgeQueue(Queue $queue): void { } diff --git a/NullMessage.php b/NullMessage.php index c9a3dfc..bd48a38 100644 --- a/NullMessage.php +++ b/NullMessage.php @@ -4,9 +4,9 @@ namespace Enqueue\Null; -use Interop\Queue\PsrMessage; +use Interop\Queue\Message; -class NullMessage implements PsrMessage +class NullMessage implements Message { /** * @var string diff --git a/NullProducer.php b/NullProducer.php index fc36aa8..47235e7 100644 --- a/NullProducer.php +++ b/NullProducer.php @@ -4,11 +4,11 @@ namespace Enqueue\Null; -use Interop\Queue\PsrDestination; -use Interop\Queue\PsrMessage; -use Interop\Queue\PsrProducer; +use Interop\Queue\Destination; +use Interop\Queue\Message; +use Interop\Queue\Producer; -class NullProducer implements PsrProducer +class NullProducer implements Producer { private $priority; @@ -16,14 +16,14 @@ class NullProducer implements PsrProducer private $deliveryDelay; - public function send(PsrDestination $destination, PsrMessage $message): void + public function send(Destination $destination, Message $message): void { } /** * @return NullProducer */ - public function setDeliveryDelay(int $deliveryDelay = null): PsrProducer + public function setDeliveryDelay(int $deliveryDelay = null): Producer { $this->deliveryDelay = $deliveryDelay; @@ -38,7 +38,7 @@ public function getDeliveryDelay(): ?int /** * @return NullProducer */ - public function setPriority(int $priority = null): PsrProducer + public function setPriority(int $priority = null): Producer { $this->priority = $priority; @@ -53,7 +53,7 @@ public function getPriority(): ?int /** * @return NullProducer */ - public function setTimeToLive(int $timeToLive = null): PsrProducer + public function setTimeToLive(int $timeToLive = null): Producer { $this->timeToLive = $timeToLive; diff --git a/NullQueue.php b/NullQueue.php index 0950bb7..543111e 100644 --- a/NullQueue.php +++ b/NullQueue.php @@ -4,9 +4,9 @@ namespace Enqueue\Null; -use Interop\Queue\PsrQueue; +use Interop\Queue\Queue; -class NullQueue implements PsrQueue +class NullQueue implements Queue { /** * @var string diff --git a/NullSubscriptionConsumer.php b/NullSubscriptionConsumer.php index a7940a0..1e95916 100644 --- a/NullSubscriptionConsumer.php +++ b/NullSubscriptionConsumer.php @@ -4,20 +4,20 @@ namespace Enqueue\Null; -use Interop\Queue\PsrConsumer; -use Interop\Queue\PsrSubscriptionConsumer; +use Interop\Queue\Consumer; +use Interop\Queue\SubscriptionConsumer; -class NullSubscriptionConsumer implements PsrSubscriptionConsumer +class NullSubscriptionConsumer implements SubscriptionConsumer { public function consume(int $timeout = 0): void { } - public function subscribe(PsrConsumer $consumer, callable $callback): void + public function subscribe(Consumer $consumer, callable $callback): void { } - public function unsubscribe(PsrConsumer $consumer): void + public function unsubscribe(Consumer $consumer): void { } diff --git a/NullTopic.php b/NullTopic.php index e95223f..9c86ad0 100644 --- a/NullTopic.php +++ b/NullTopic.php @@ -2,9 +2,9 @@ namespace Enqueue\Null; -use Interop\Queue\PsrTopic; +use Interop\Queue\Topic; -class NullTopic implements PsrTopic +class NullTopic implements Topic { /** * @var string diff --git a/README.md b/README.md index bebd312..14f7a03 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Total Downloads](https://poser.pugx.org/enqueue/null/d/total.png)](https://packagist.org/packages/enqueue/null) [![Latest Stable Version](https://poser.pugx.org/enqueue/null/version.png)](https://packagist.org/packages/enqueue/null) -This is an implementation of PSR queue specification. It does not send messages any where and could be used as mock. Suitable in tests. +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 diff --git a/Tests/NullConnectionFactoryTest.php b/Tests/NullConnectionFactoryTest.php index a1e6e90..80cfcc9 100644 --- a/Tests/NullConnectionFactoryTest.php +++ b/Tests/NullConnectionFactoryTest.php @@ -5,7 +5,7 @@ use Enqueue\Null\NullConnectionFactory; use Enqueue\Null\NullContext; use Enqueue\Test\ClassExtensionTrait; -use Interop\Queue\PsrConnectionFactory; +use Interop\Queue\ConnectionFactory; use PHPUnit\Framework\TestCase; class NullConnectionFactoryTest extends TestCase @@ -14,7 +14,7 @@ class NullConnectionFactoryTest extends TestCase public function testShouldImplementConnectionFactoryInterface() { - $this->assertClassImplements(PsrConnectionFactory::class, NullConnectionFactory::class); + $this->assertClassImplements(ConnectionFactory::class, NullConnectionFactory::class); } public function testCouldBeConstructedWithoutAnyArguments() diff --git a/Tests/NullConsumerTest.php b/Tests/NullConsumerTest.php index e7e6ae6..6419e9c 100644 --- a/Tests/NullConsumerTest.php +++ b/Tests/NullConsumerTest.php @@ -6,7 +6,7 @@ use Enqueue\Null\NullMessage; use Enqueue\Null\NullQueue; use Enqueue\Test\ClassExtensionTrait; -use Interop\Queue\PsrConsumer; +use Interop\Queue\Consumer; use PHPUnit\Framework\TestCase; class NullConsumerTest extends TestCase @@ -15,7 +15,7 @@ class NullConsumerTest extends TestCase public function testShouldImplementMessageConsumerInterface() { - $this->assertClassImplements(PsrConsumer::class, NullConsumer::class); + $this->assertClassImplements(Consumer::class, NullConsumer::class); } public function testCouldBeConstructedWithQueueAsArgument() diff --git a/Tests/NullContextTest.php b/Tests/NullContextTest.php index 1a4c90c..4e51509 100644 --- a/Tests/NullContextTest.php +++ b/Tests/NullContextTest.php @@ -9,7 +9,7 @@ use Enqueue\Null\NullQueue; use Enqueue\Null\NullTopic; use Enqueue\Test\ClassExtensionTrait; -use Interop\Queue\PsrContext; +use Interop\Queue\Context; use PHPUnit\Framework\TestCase; class NullContextTest extends TestCase @@ -18,7 +18,7 @@ class NullContextTest extends TestCase public function testShouldImplementSessionInterface() { - $this->assertClassImplements(PsrContext::class, NullContext::class); + $this->assertClassImplements(Context::class, NullContext::class); } public function testCouldBeConstructedWithoutAnyArguments() diff --git a/Tests/NullMessageTest.php b/Tests/NullMessageTest.php index 9870c7c..f8a7090 100644 --- a/Tests/NullMessageTest.php +++ b/Tests/NullMessageTest.php @@ -4,7 +4,7 @@ use Enqueue\Null\NullMessage; use Enqueue\Test\ClassExtensionTrait; -use Interop\Queue\PsrMessage; +use Interop\Queue\Message; use PHPUnit\Framework\TestCase; class NullMessageTest extends TestCase @@ -13,7 +13,7 @@ class NullMessageTest extends TestCase public function testShouldImplementMessageInterface() { - $this->assertClassImplements(PsrMessage::class, NullMessage::class); + $this->assertClassImplements(Message::class, NullMessage::class); } public function testCouldBeConstructedWithoutAnyArguments() diff --git a/Tests/NullProducerTest.php b/Tests/NullProducerTest.php index c9f89b6..289dab6 100644 --- a/Tests/NullProducerTest.php +++ b/Tests/NullProducerTest.php @@ -6,7 +6,7 @@ use Enqueue\Null\NullProducer; use Enqueue\Null\NullTopic; use Enqueue\Test\ClassExtensionTrait; -use Interop\Queue\PsrProducer; +use Interop\Queue\Producer; use PHPUnit\Framework\TestCase; class NullProducerTest extends TestCase @@ -15,7 +15,7 @@ class NullProducerTest extends TestCase public function testShouldImplementProducerInterface() { - $this->assertClassImplements(PsrProducer::class, NullProducer::class); + $this->assertClassImplements(Producer::class, NullProducer::class); } public function testCouldBeConstructedWithoutAnyArguments() diff --git a/Tests/NullQueueTest.php b/Tests/NullQueueTest.php index ff2c9bd..0dfaf2f 100644 --- a/Tests/NullQueueTest.php +++ b/Tests/NullQueueTest.php @@ -4,7 +4,7 @@ use Enqueue\Null\NullQueue; use Enqueue\Test\ClassExtensionTrait; -use Interop\Queue\PsrQueue; +use Interop\Queue\Queue; use PHPUnit\Framework\TestCase; class NullQueueTest extends TestCase @@ -13,7 +13,7 @@ class NullQueueTest extends TestCase public function testShouldImplementQueueInterface() { - $this->assertClassImplements(PsrQueue::class, NullQueue::class); + $this->assertClassImplements(Queue::class, NullQueue::class); } public function testCouldBeConstructedWithNameAsArgument() diff --git a/Tests/NullTopicTest.php b/Tests/NullTopicTest.php index b07641e..a405451 100644 --- a/Tests/NullTopicTest.php +++ b/Tests/NullTopicTest.php @@ -4,7 +4,7 @@ use Enqueue\Null\NullTopic; use Enqueue\Test\ClassExtensionTrait; -use Interop\Queue\PsrTopic; +use Interop\Queue\Topic; use PHPUnit\Framework\TestCase; class NullTopicTest extends TestCase @@ -13,7 +13,7 @@ class NullTopicTest extends TestCase public function testShouldImplementTopicInterface() { - $this->assertClassImplements(PsrTopic::class, NullTopic::class); + $this->assertClassImplements(Topic::class, NullTopic::class); } public function testCouldBeConstructedWithNameAsArgument() From bde706dd02ed042a1777a5804a807508f7eff781 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Fri, 28 Sep 2018 15:18:46 +0300 Subject: [PATCH 21/45] Remove "Psr" prefix from spec base tests. --- Tests/Spec/NullMessageTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/Spec/NullMessageTest.php b/Tests/Spec/NullMessageTest.php index 02b5cc2..34c6863 100644 --- a/Tests/Spec/NullMessageTest.php +++ b/Tests/Spec/NullMessageTest.php @@ -3,9 +3,9 @@ namespace Enqueue\Null\Tests\Spec; use Enqueue\Null\NullMessage; -use Interop\Queue\Spec\PsrMessageSpec; +use Interop\Queue\Spec\MessageSpec; -class NullMessageTest extends PsrMessageSpec +class NullMessageTest extends MessageSpec { /** * {@inheritdoc} From e29b2970df76f2e4811fd8166225f393e4b7da09 Mon Sep 17 00:00:00 2001 From: webmake Date: Sat, 27 Oct 2018 10:56:55 +0000 Subject: [PATCH 22/45] Do not export non source files --- .gitattributes | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bdf2dcb --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +/Tests export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.travis.yml export-ignore +phpunit.xml.dist export-ignore From 324b4dbb4db3afd390366c5bb05d146c336635fb Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Tue, 6 Nov 2018 18:06:13 +0200 Subject: [PATCH 23/45] [doc][skip ci] Add sponsoring section. --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 14f7a03..e1dbdea 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ +

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 Transport [![Gitter](https://badges.gitter.im/php-enqueue/Lobby.svg)](https://gitter.im/php-enqueue/Lobby) From dcfcaa143ab13a5a5e0e58d7d29cc450971a2d36 Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Tue, 6 Nov 2018 18:12:08 +0200 Subject: [PATCH 24/45] [docs][skip ci] Add sponsoring to docs. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e1dbdea..02eadb8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ 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 a sponsor](https://www.patreon.com/makasim) - [Become our client](http://forma-pro.com/) --- From f52b11aea77b132bc4d51017dd2a95a2a766bb07 Mon Sep 17 00:00:00 2001 From: Alexander Kozienko Date: Fri, 16 Nov 2018 13:52:04 +0200 Subject: [PATCH 25/45] multi client configuration --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index e174356..cb900e1 100644 --- a/composer.json +++ b/composer.json @@ -7,12 +7,12 @@ "license": "MIT", "require": { "php": "^7.1.3", - "queue-interop/queue-interop": "0.7.x-dev" + "queue-interop/queue-interop": "^0.7" }, "require-dev": { "phpunit/phpunit": "~5.5", "enqueue/test": "0.9.x-dev", - "queue-interop/queue-spec": "0.6.x-dev" + "queue-interop/queue-spec": "^0.6" }, "support": { "email": "opensource@forma-pro.com", From 47802550b673fd864b138b1d07e415bc7d49e9b4 Mon Sep 17 00:00:00 2001 From: webmake Date: Sat, 27 Oct 2018 13:56:55 +0300 Subject: [PATCH 26/45] Do not export non source files (cherry picked from commit 404fae1) --- .gitattributes | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bdf2dcb --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +/Tests export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.travis.yml export-ignore +phpunit.xml.dist export-ignore From 7d3e5b5836501fde5de1f5867ce070e4b7cc09a1 Mon Sep 17 00:00:00 2001 From: Kotlyar Maksim Date: Thu, 13 Dec 2018 17:31:01 +0200 Subject: [PATCH 27/45] Allow queue interop 0.8 in packages --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index cb900e1..1fa1a2c 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "license": "MIT", "require": { "php": "^7.1.3", - "queue-interop/queue-interop": "^0.7" + "queue-interop/queue-interop": "^0.7|^0.8" }, "require-dev": { "phpunit/phpunit": "~5.5", From 7052f9cc4a5d132fd3c3c7a42e2b8dac2fd5050a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Niedzielski?= Date: Mon, 27 May 2019 15:12:22 +0200 Subject: [PATCH 28/45] Prefer github pages in packages' readme files --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 02eadb8..46a57b6 100644 --- a/README.md +++ b/README.md @@ -13,20 +13,20 @@ Enqueue is an MIT-licensed open source project with its ongoing development made [![Build Status](https://travis-ci.org/php-enqueue/null.png?branch=master)](https://travis-ci.org/php-enqueue/null) [![Total Downloads](https://poser.pugx.org/enqueue/null/d/total.png)](https://packagist.org/packages/enqueue/null) [![Latest Stable Version](https://poser.pugx.org/enqueue/null/version.png)](https://packagist.org/packages/enqueue/null) - + 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://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md) +* [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. +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 From 83d25adb2a2840ef12e58fd28eec5b4734779294 Mon Sep 17 00:00:00 2001 From: Mathieu Lemoine Date: Wed, 11 Dec 2019 16:32:12 +0100 Subject: [PATCH 29/45] Reduced dependency to voryx/Thruway --- phpunit.xml.dist | 1 - 1 file changed, 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 2fd4e20..2c7c8b1 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="./vendor/autoload.php" > From 25b322ec6f32dde5f46efaab4b02137d1e1edbfd Mon Sep 17 00:00:00 2001 From: Maksim Kotlyar Date: Thu, 19 Dec 2019 09:01:09 +0200 Subject: [PATCH 30/45] master is 0.10 --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 1fa1a2c..e2ef6c2 100644 --- a/composer.json +++ b/composer.json @@ -7,11 +7,11 @@ "license": "MIT", "require": { "php": "^7.1.3", - "queue-interop/queue-interop": "^0.7|^0.8" + "queue-interop/queue-interop": "^0.8" }, "require-dev": { - "phpunit/phpunit": "~5.5", - "enqueue/test": "0.9.x-dev", + "phpunit/phpunit": "~7.5", + "enqueue/test": "0.10.x-dev", "queue-interop/queue-spec": "^0.6" }, "support": { @@ -30,7 +30,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "0.9.x-dev" + "dev-master": "0.10.x-dev" } } } From 7fb83a0f87ce3a95645a9aa2c495200e453dd366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Niedzielski?= Date: Mon, 27 Jan 2020 00:45:10 +0100 Subject: [PATCH 31/45] Add schema declaration to phpunit files. Remove parameters set to phpunit defaults. --- phpunit.xml.dist | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 2c7c8b1..0772924 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,15 +1,11 @@ - + From 8e17ca9195abdb5e6b2d6f55a4fd7292951ab715 Mon Sep 17 00:00:00 2001 From: Witold Wasiczko Date: Thu, 30 Jul 2020 20:38:01 +0200 Subject: [PATCH 32/45] Add php 7.3 and 7.4 travis env to test --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 9ed4fa1..ae8b10d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,8 @@ language: php php: - '7.1' - '7.2' + - '7.3' + - '7.4' cache: directories: From 96aa6fa0d3820137b3c428679e95baad32344184 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Mon, 25 Jan 2021 09:51:30 +0200 Subject: [PATCH 33/45] Update PHP and PHPUnit across all packages; fix ext-rdkafka requirement --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index e2ef6c2..5c43f40 100644 --- a/composer.json +++ b/composer.json @@ -6,11 +6,11 @@ "homepage": "https://enqueue.forma-pro.com/", "license": "MIT", "require": { - "php": "^7.1.3", + "php": "^7.3", "queue-interop/queue-interop": "^0.8" }, "require-dev": { - "phpunit/phpunit": "~7.5", + "phpunit/phpunit": "^9.5", "enqueue/test": "0.10.x-dev", "queue-interop/queue-spec": "^0.6" }, From 5269a8be0d817c88497b822f07795c913ef7a7da Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 9 Feb 2021 02:14:42 +0200 Subject: [PATCH 34/45] Fix package CI - Add push to master trigger; - Replace the clunky cache + composer install steps with an Action; - Replace Travis with GH WF in packages; - Add the missing CI to amqp-tools; - Replace the shields. --- .github/workflows/ci.yml | 29 +++++++++++++++++++++++++++++ .travis.yml | 23 ----------------------- README.md | 2 +- 3 files changed, 30 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f2accab --- /dev/null +++ b/.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'] + + 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 --exlude-group=functional diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ae8b10d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -sudo: false - -git: - depth: 10 - -language: php - -php: - - '7.1' - - '7.2' - - '7.3' - - '7.4' - -cache: - directories: - - $HOME/.composer/cache - -install: - - composer self-update - - composer install --prefer-source - -script: - - vendor/bin/phpunit --exclude-group=functional diff --git a/README.md b/README.md index 46a57b6..c66b469 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Enqueue is an MIT-licensed open source project with its ongoing development made # Enqueue Null Transport [![Gitter](https://badges.gitter.im/php-enqueue/Lobby.svg)](https://gitter.im/php-enqueue/Lobby) -[![Build Status](https://travis-ci.org/php-enqueue/null.png?branch=master)](https://travis-ci.org/php-enqueue/null) +[![Build Status](https://img.shields.io/github/workflow/status/php-enqueue/null/CI)](https://github.com/php-enqueue/null/actions?query=workflow%3ACI) [![Total Downloads](https://poser.pugx.org/enqueue/null/d/total.png)](https://packagist.org/packages/enqueue/null) [![Latest Stable Version](https://poser.pugx.org/enqueue/null/version.png)](https://packagist.org/packages/enqueue/null) From ca4488d194af13d402fd95529846433ee60f6c57 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Mon, 25 Jan 2021 10:26:59 +0200 Subject: [PATCH 35/45] Allow php8 in all composer.json files --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5c43f40..bd00fb0 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "homepage": "https://enqueue.forma-pro.com/", "license": "MIT", "require": { - "php": "^7.3", + "php": "^7.3|^8.0", "queue-interop/queue-interop": "^0.8" }, "require-dev": { From 2b1226f4a75330c0de0152945220fefac27d049d Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 9 Feb 2021 14:01:28 +0200 Subject: [PATCH 36/45] Add php 8 to packages' build matrices; normalize composer reqs --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2accab..fd2ae7f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.3', '7.4'] + php: ['7.3', '7.4', '8.0'] name: PHP ${{ matrix.php }} tests From 25614c0b058a8535766b018289a69f288dca97a8 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Thu, 11 Feb 2021 03:45:55 +0200 Subject: [PATCH 37/45] Bump some minimal deps --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bd00fb0..ab84dc3 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "require-dev": { "phpunit/phpunit": "^9.5", "enqueue/test": "0.10.x-dev", - "queue-interop/queue-spec": "^0.6" + "queue-interop/queue-spec": "^0.6.2" }, "support": { "email": "opensource@forma-pro.com", From 1f7b17d43b7dfdce9047a484625db3cb888e0dc7 Mon Sep 17 00:00:00 2001 From: Witold Wasiczko Date: Fri, 29 Oct 2021 22:37:39 +0200 Subject: [PATCH 38/45] Fix run ci tests for null package --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd2ae7f..a168dca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,4 +26,4 @@ jobs: with: composer-options: "--prefer-source" - - run: vendor/bin/phpunit --exlude-group=functional + - run: vendor/bin/phpunit --exclude-group=functional From 7f2c3d2695e7ac4dcefa67c3cb69031fb2a932ea Mon Sep 17 00:00:00 2001 From: Alex Mayer Date: Sat, 25 Feb 2023 22:18:02 -0500 Subject: [PATCH 39/45] Fix Shield URLs in READMEs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c66b469..7d78ae0 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Enqueue is an MIT-licensed open source project with its ongoing development made # Enqueue Null 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/null/CI)](https://github.com/php-enqueue/null/actions?query=workflow%3ACI) +[![Build Status](https://img.shields.io/github/actions/workflow/status/php-enqueue/null/ci.yml?branch=master)](https://github.com/php-enqueue/null/actions?query=workflow%3ACI) [![Total Downloads](https://poser.pugx.org/enqueue/null/d/total.png)](https://packagist.org/packages/enqueue/null) [![Latest Stable Version](https://poser.pugx.org/enqueue/null/version.png)](https://packagist.org/packages/enqueue/null) From 9ac3d1a9e9695e56922c88a2f9a325a6184853f5 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Sun, 19 Feb 2023 15:13:41 +0200 Subject: [PATCH 40/45] Properly drop old PHP and Symfony versions --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ab84dc3..0f4ac4e 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "homepage": "https://enqueue.forma-pro.com/", "license": "MIT", "require": { - "php": "^7.3|^8.0", + "php": "^7.4|^8.0", "queue-interop/queue-interop": "^0.8" }, "require-dev": { From c7174da80c59b04391c5194cebe46b6f85d79fb4 Mon Sep 17 00:00:00 2001 From: Witold Wasiczko Date: Thu, 23 Mar 2023 10:50:55 +0100 Subject: [PATCH 41/45] Update and fix pkg test with 8.1 and 8.2 PHP support --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a168dca..0492424 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.3', '7.4', '8.0'] + php: ['7.4', '8.0', '8.1', '8.2'] name: PHP ${{ matrix.php }} tests From eea57f9bee9d5521843e753c9c30d1286fa1943a Mon Sep 17 00:00:00 2001 From: James Read Date: Sat, 11 Jan 2025 20:47:49 +0000 Subject: [PATCH 42/45] Fixing risky tests Makring tests that have no assertions with the annotation to suppress phpunits warning around risky tests closes 1370 --- Tests/NullConnectionFactoryTest.php | 3 +++ Tests/NullConsumerTest.php | 9 +++++++++ Tests/NullContextTest.php | 3 +++ Tests/NullProducerTest.php | 6 ++++++ Tests/NullQueueTest.php | 3 +++ Tests/NullTopicTest.php | 3 +++ 6 files changed, 27 insertions(+) diff --git a/Tests/NullConnectionFactoryTest.php b/Tests/NullConnectionFactoryTest.php index 80cfcc9..8c25995 100644 --- a/Tests/NullConnectionFactoryTest.php +++ b/Tests/NullConnectionFactoryTest.php @@ -17,6 +17,9 @@ public function testShouldImplementConnectionFactoryInterface() $this->assertClassImplements(ConnectionFactory::class, NullConnectionFactory::class); } + /** + * @doesNotPerformAssertions + */ public function testCouldBeConstructedWithoutAnyArguments() { new NullConnectionFactory(); diff --git a/Tests/NullConsumerTest.php b/Tests/NullConsumerTest.php index 6419e9c..5db15ae 100644 --- a/Tests/NullConsumerTest.php +++ b/Tests/NullConsumerTest.php @@ -18,6 +18,9 @@ public function testShouldImplementMessageConsumerInterface() $this->assertClassImplements(Consumer::class, NullConsumer::class); } + /** + * @doesNotPerformAssertions + */ public function testCouldBeConstructedWithQueueAsArgument() { new NullConsumer(new NullQueue('aName')); @@ -41,6 +44,9 @@ public function testShouldAlwaysReturnNullOnReceiveNoWait() $this->assertNull($consumer->receiveNoWait()); } + /** + * @doesNotPerformAssertions + */ public function testShouldDoNothingOnAcknowledge() { $consumer = new NullConsumer(new NullQueue('theQueueName')); @@ -48,6 +54,9 @@ public function testShouldDoNothingOnAcknowledge() $consumer->acknowledge(new NullMessage()); } + /** + * @doesNotPerformAssertions + */ public function testShouldDoNothingOnReject() { $consumer = new NullConsumer(new NullQueue('theQueueName')); diff --git a/Tests/NullContextTest.php b/Tests/NullContextTest.php index 4e51509..257eee8 100644 --- a/Tests/NullContextTest.php +++ b/Tests/NullContextTest.php @@ -21,6 +21,9 @@ public function testShouldImplementSessionInterface() $this->assertClassImplements(Context::class, NullContext::class); } + /** + * @doesNotPerformAssertions + */ public function testCouldBeConstructedWithoutAnyArguments() { new NullContext(); diff --git a/Tests/NullProducerTest.php b/Tests/NullProducerTest.php index 289dab6..1493104 100644 --- a/Tests/NullProducerTest.php +++ b/Tests/NullProducerTest.php @@ -18,11 +18,17 @@ public function testShouldImplementProducerInterface() $this->assertClassImplements(Producer::class, NullProducer::class); } + /** + * @doesNotPerformAssertions + */ public function testCouldBeConstructedWithoutAnyArguments() { new NullProducer(); } + /** + * @doesNotPerformAssertions + */ public function testShouldDoNothingOnSend() { $producer = new NullProducer(); diff --git a/Tests/NullQueueTest.php b/Tests/NullQueueTest.php index 0dfaf2f..cace664 100644 --- a/Tests/NullQueueTest.php +++ b/Tests/NullQueueTest.php @@ -16,6 +16,9 @@ public function testShouldImplementQueueInterface() $this->assertClassImplements(Queue::class, NullQueue::class); } + /** + * @doesNotPerformAssertions + */ public function testCouldBeConstructedWithNameAsArgument() { new NullQueue('aName'); diff --git a/Tests/NullTopicTest.php b/Tests/NullTopicTest.php index a405451..017df32 100644 --- a/Tests/NullTopicTest.php +++ b/Tests/NullTopicTest.php @@ -16,6 +16,9 @@ public function testShouldImplementTopicInterface() $this->assertClassImplements(Topic::class, NullTopic::class); } + /** + * @doesNotPerformAssertions + */ public function testCouldBeConstructedWithNameAsArgument() { new NullTopic('aName'); From bae7b5fb525f198c6093064f03dd25e6a06a7965 Mon Sep 17 00:00:00 2001 From: James Read Date: Wed, 15 Jan 2025 21:17:06 +0000 Subject: [PATCH 43/45] Removing constructor tests Removing all tests that creates a new instance but doesn't call any methods nor preform any assertions. --- Tests/NullConnectionFactoryTest.php | 8 -------- Tests/NullConsumerTest.php | 8 -------- Tests/NullContextTest.php | 8 -------- Tests/NullProducerTest.php | 8 -------- Tests/NullQueueTest.php | 8 -------- Tests/NullTopicTest.php | 8 -------- 6 files changed, 48 deletions(-) diff --git a/Tests/NullConnectionFactoryTest.php b/Tests/NullConnectionFactoryTest.php index 8c25995..bbf377e 100644 --- a/Tests/NullConnectionFactoryTest.php +++ b/Tests/NullConnectionFactoryTest.php @@ -17,14 +17,6 @@ public function testShouldImplementConnectionFactoryInterface() $this->assertClassImplements(ConnectionFactory::class, NullConnectionFactory::class); } - /** - * @doesNotPerformAssertions - */ - public function testCouldBeConstructedWithoutAnyArguments() - { - new NullConnectionFactory(); - } - public function testShouldReturnNullContextOnCreateContextCall() { $factory = new NullConnectionFactory(); diff --git a/Tests/NullConsumerTest.php b/Tests/NullConsumerTest.php index 5db15ae..f4de533 100644 --- a/Tests/NullConsumerTest.php +++ b/Tests/NullConsumerTest.php @@ -18,14 +18,6 @@ public function testShouldImplementMessageConsumerInterface() $this->assertClassImplements(Consumer::class, NullConsumer::class); } - /** - * @doesNotPerformAssertions - */ - public function testCouldBeConstructedWithQueueAsArgument() - { - new NullConsumer(new NullQueue('aName')); - } - public function testShouldAlwaysReturnNullOnReceive() { $consumer = new NullConsumer(new NullQueue('theQueueName')); diff --git a/Tests/NullContextTest.php b/Tests/NullContextTest.php index 257eee8..f0da566 100644 --- a/Tests/NullContextTest.php +++ b/Tests/NullContextTest.php @@ -21,14 +21,6 @@ public function testShouldImplementSessionInterface() $this->assertClassImplements(Context::class, NullContext::class); } - /** - * @doesNotPerformAssertions - */ - public function testCouldBeConstructedWithoutAnyArguments() - { - new NullContext(); - } - public function testShouldAllowCreateMessageWithoutAnyArguments() { $context = new NullContext(); diff --git a/Tests/NullProducerTest.php b/Tests/NullProducerTest.php index 1493104..140d683 100644 --- a/Tests/NullProducerTest.php +++ b/Tests/NullProducerTest.php @@ -18,14 +18,6 @@ public function testShouldImplementProducerInterface() $this->assertClassImplements(Producer::class, NullProducer::class); } - /** - * @doesNotPerformAssertions - */ - public function testCouldBeConstructedWithoutAnyArguments() - { - new NullProducer(); - } - /** * @doesNotPerformAssertions */ diff --git a/Tests/NullQueueTest.php b/Tests/NullQueueTest.php index cace664..cb29ca1 100644 --- a/Tests/NullQueueTest.php +++ b/Tests/NullQueueTest.php @@ -16,14 +16,6 @@ public function testShouldImplementQueueInterface() $this->assertClassImplements(Queue::class, NullQueue::class); } - /** - * @doesNotPerformAssertions - */ - public function testCouldBeConstructedWithNameAsArgument() - { - new NullQueue('aName'); - } - public function testShouldAllowGetNameSetInConstructor() { $queue = new NullQueue('theName'); diff --git a/Tests/NullTopicTest.php b/Tests/NullTopicTest.php index 017df32..27c4b58 100644 --- a/Tests/NullTopicTest.php +++ b/Tests/NullTopicTest.php @@ -16,14 +16,6 @@ public function testShouldImplementTopicInterface() $this->assertClassImplements(Topic::class, NullTopic::class); } - /** - * @doesNotPerformAssertions - */ - public function testCouldBeConstructedWithNameAsArgument() - { - new NullTopic('aName'); - } - public function testShouldAllowGetNameSetInConstructor() { $topic = new NullTopic('theName'); From ba5374e6c4aa99114e3c9c65815fefb910a50eab Mon Sep 17 00:00:00 2001 From: James Read Date: Wed, 15 Jan 2025 22:51:32 +0000 Subject: [PATCH 44/45] Running php-cs-fixer Running php-cs-fixer to fix CS drift --- NullMessage.php | 8 ++++---- NullProducer.php | 6 +++--- Tests/Spec/NullMessageTest.php | 3 --- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/NullMessage.php b/NullMessage.php index bd48a38..93fc57c 100644 --- a/NullMessage.php +++ b/NullMessage.php @@ -97,7 +97,7 @@ public function setRedelivered(bool $redelivered): void $this->redelivered = $redelivered; } - public function setCorrelationId(string $correlationId = null): void + public function setCorrelationId(?string $correlationId = null): void { $headers = $this->getHeaders(); $headers['correlation_id'] = (string) $correlationId; @@ -110,7 +110,7 @@ public function getCorrelationId(): ?string return $this->getHeader('correlation_id'); } - public function setMessageId(string $messageId = null): void + public function setMessageId(?string $messageId = null): void { $headers = $this->getHeaders(); $headers['message_id'] = (string) $messageId; @@ -130,7 +130,7 @@ public function getTimestamp(): ?int return null === $value ? null : (int) $value; } - public function setTimestamp(int $timestamp = null): void + public function setTimestamp(?int $timestamp = null): void { $headers = $this->getHeaders(); $headers['timestamp'] = (int) $timestamp; @@ -138,7 +138,7 @@ public function setTimestamp(int $timestamp = null): void $this->setHeaders($headers); } - public function setReplyTo(string $replyTo = null): void + public function setReplyTo(?string $replyTo = null): void { $this->setHeader('reply_to', $replyTo); } diff --git a/NullProducer.php b/NullProducer.php index 47235e7..1349de9 100644 --- a/NullProducer.php +++ b/NullProducer.php @@ -23,7 +23,7 @@ public function send(Destination $destination, Message $message): void /** * @return NullProducer */ - public function setDeliveryDelay(int $deliveryDelay = null): Producer + public function setDeliveryDelay(?int $deliveryDelay = null): Producer { $this->deliveryDelay = $deliveryDelay; @@ -38,7 +38,7 @@ public function getDeliveryDelay(): ?int /** * @return NullProducer */ - public function setPriority(int $priority = null): Producer + public function setPriority(?int $priority = null): Producer { $this->priority = $priority; @@ -53,7 +53,7 @@ public function getPriority(): ?int /** * @return NullProducer */ - public function setTimeToLive(int $timeToLive = null): Producer + public function setTimeToLive(?int $timeToLive = null): Producer { $this->timeToLive = $timeToLive; diff --git a/Tests/Spec/NullMessageTest.php b/Tests/Spec/NullMessageTest.php index 34c6863..6bacc92 100644 --- a/Tests/Spec/NullMessageTest.php +++ b/Tests/Spec/NullMessageTest.php @@ -7,9 +7,6 @@ class NullMessageTest extends MessageSpec { - /** - * {@inheritdoc} - */ protected function createMessage() { return new NullMessage(); From 9b72cc0be749d9f3c3e31e251c738705f0fbf18d Mon Sep 17 00:00:00 2001 From: James Read Date: Sun, 27 Apr 2025 14:30:31 +0100 Subject: [PATCH 45/45] Updating composer Updating composer.json in pkg directory to correctly reflect the supported versions of PHP --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0f4ac4e..a09910a 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "homepage": "https://enqueue.forma-pro.com/", "license": "MIT", "require": { - "php": "^7.4|^8.0", + "php": "^8.1", "queue-interop/queue-interop": "^0.8" }, "require-dev": {