diff --git a/docs/transport/sqs.md b/docs/transport/sqs.md index 8f447d40d..6706fae8d 100644 --- a/docs/transport/sqs.md +++ b/docs/transport/sqs.md @@ -110,7 +110,7 @@ $consumer->acknowledge($message); $fooQueue = $psrContext->createQueue('foo'); -$psrContext->purge($fooQueue); +$psrContext->purgeQueue($fooQueue); ``` [back to index](../index.md) diff --git a/pkg/amqp-bunny/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php b/pkg/amqp-bunny/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php index 974cee445..5164332b2 100644 --- a/pkg/amqp-bunny/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php +++ b/pkg/amqp-bunny/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php @@ -13,6 +13,15 @@ */ class AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest extends SubscriptionConsumerConsumeUntilUnsubscribedSpec { + protected function tearDown() + { + if ($this->subscriptionConsumer) { + $this->subscriptionConsumer->unsubscribeAll(); + } + + parent::tearDown(); + } + /** * @return AmqpContext * diff --git a/pkg/amqp-bunny/composer.json b/pkg/amqp-bunny/composer.json index c7bd071c1..cc9563c9b 100644 --- a/pkg/amqp-bunny/composer.json +++ b/pkg/amqp-bunny/composer.json @@ -16,7 +16,7 @@ "enqueue/test": "0.9.x-dev", "enqueue/enqueue": "0.9.x-dev", "enqueue/null": "0.9.x-dev", - "queue-interop/queue-spec": "^0.5.8@dev", + "queue-interop/queue-spec": "^0.5.9@dev", "symfony/dependency-injection": "^3.4|^4", "symfony/config": "^3.4|^4" }, diff --git a/pkg/amqp-ext/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php b/pkg/amqp-ext/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php index f15f6aba2..123bd2e39 100644 --- a/pkg/amqp-ext/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php +++ b/pkg/amqp-ext/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php @@ -13,6 +13,15 @@ */ class AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest extends SubscriptionConsumerConsumeUntilUnsubscribedSpec { + protected function tearDown() + { + if ($this->subscriptionConsumer) { + $this->subscriptionConsumer->unsubscribeAll(); + } + + parent::tearDown(); + } + /** * @return AmqpContext * diff --git a/pkg/amqp-ext/composer.json b/pkg/amqp-ext/composer.json index f16bca846..18318f3e6 100644 --- a/pkg/amqp-ext/composer.json +++ b/pkg/amqp-ext/composer.json @@ -16,7 +16,7 @@ "enqueue/test": "0.9.x-dev", "enqueue/enqueue": "0.9.x-dev", "enqueue/null": "0.9.x-dev", - "queue-interop/queue-spec": "^0.5.8@dev", + "queue-interop/queue-spec": "^0.5.9@dev", "empi89/php-amqp-stubs": "*@dev", "symfony/dependency-injection": "^3.4|^4", "symfony/config": "^3.4|^4" diff --git a/pkg/amqp-lib/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php b/pkg/amqp-lib/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php index add0b87d4..aaaa93318 100644 --- a/pkg/amqp-lib/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php +++ b/pkg/amqp-lib/Tests/Spec/AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest.php @@ -13,6 +13,15 @@ */ class AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest extends SubscriptionConsumerConsumeUntilUnsubscribedSpec { + protected function tearDown() + { + if ($this->subscriptionConsumer) { + $this->subscriptionConsumer->unsubscribeAll(); + } + + parent::tearDown(); + } + /** * @return AmqpContext * diff --git a/pkg/amqp-lib/composer.json b/pkg/amqp-lib/composer.json index cd4a18707..c1a6781a9 100644 --- a/pkg/amqp-lib/composer.json +++ b/pkg/amqp-lib/composer.json @@ -16,7 +16,7 @@ "enqueue/test": "0.9.x-dev", "enqueue/enqueue": "0.9.x-dev", "enqueue/null": "0.9.x-dev", - "queue-interop/queue-spec": "^0.5.8@dev", + "queue-interop/queue-spec": "^0.5.9@dev", "symfony/dependency-injection": "^3.4|^4", "symfony/config": "^3.4|^4" }, diff --git a/pkg/amqp-tools/SubscriptionConsumer.php b/pkg/amqp-tools/SubscriptionConsumer.php deleted file mode 100644 index e992a6b06..000000000 --- a/pkg/amqp-tools/SubscriptionConsumer.php +++ /dev/null @@ -1,57 +0,0 @@ -context = $context; - } - - /** - * {@inheritdoc} - */ - public function consume($timeout = 0) - { - $this->context->consume($timeout); - } - - /** - * {@inheritdoc} - */ - public function subscribe(PsrConsumer $consumer, callable $callback) - { - $this->context->subscribe($consumer, $callback); - } - - /** - * {@inheritdoc} - */ - public function unsubscribe(PsrConsumer $consumer) - { - $this->context->unsubscribe($consumer); - } - - /** - * TODO. - * - * {@inheritdoc} - */ - public function unsubscribeAll() - { - throw new \LogicException('Not implemented'); - } -} diff --git a/pkg/amqp-tools/Tests/SubscriptionConsumerTest.php b/pkg/amqp-tools/Tests/SubscriptionConsumerTest.php deleted file mode 100644 index 84b380070..000000000 --- a/pkg/amqp-tools/Tests/SubscriptionConsumerTest.php +++ /dev/null @@ -1,96 +0,0 @@ -assertTrue($rc->implementsInterface(PsrSubscriptionConsumer::class)); - } - - public function testCouldBeConstructedWithAmqpContextAsFirstArgument() - { - new SubscriptionConsumer($this->createContext()); - } - - public function testShouldProxySubscribeCallToContextMethod() - { - $consumer = $this->createConsumer(); - $callback = function () {}; - - $context = $this->createContext(); - $context - ->expects($this->once()) - ->method('subscribe') - ->with($this->identicalTo($consumer), $this->identicalTo($callback)) - ; - - $subscriptionConsumer = new SubscriptionConsumer($context); - $subscriptionConsumer->subscribe($consumer, $callback); - } - - public function testShouldProxyUnsubscribeCallToContextMethod() - { - $consumer = $this->createConsumer(); - - $context = $this->createContext(); - $context - ->expects($this->once()) - ->method('unsubscribe') - ->with($this->identicalTo($consumer)) - ; - - $subscriptionConsumer = new SubscriptionConsumer($context); - $subscriptionConsumer->unsubscribe($consumer); - } - - public function testShouldProxyConsumeCallToContextMethod() - { - $timeout = 123.456; - - $context = $this->createContext(); - $context - ->expects($this->once()) - ->method('consume') - ->with($this->identicalTo($timeout)) - ; - - $subscriptionConsumer = new SubscriptionConsumer($context); - $subscriptionConsumer->consume($timeout); - } - - public function testThrowsNotImplementedOnUnsubscribeAllCall() - { - $context = $this->createContext(); - - $subscriptionConsumer = new SubscriptionConsumer($context); - - $this->expectException(\LogicException::class); - $this->expectExceptionMessage('Not implemented'); - $subscriptionConsumer->unsubscribeAll(); - } - - /** - * @return AmqpConsumer|\PHPUnit_Framework_MockObject_MockObject - */ - private function createConsumer() - { - return $this->createMock(AmqpConsumer::class); - } - - /** - * @return AmqpContext|\PHPUnit_Framework_MockObject_MockObject - */ - private function createContext() - { - return $this->createMock(AmqpContext::class); - } -} diff --git a/pkg/job-queue/Schema.php b/pkg/job-queue/Schema.php deleted file mode 100644 index 71d6985b7..000000000 --- a/pkg/job-queue/Schema.php +++ /dev/null @@ -1,55 +0,0 @@ -uniqueTableName = $uniqueTableName; - - $schemaConfig = $connection->getSchemaManager()->createSchemaConfig(); - - parent::__construct([], [], $schemaConfig); - - $this->addUniqueJobTable(); - } - - /** - * Merges ACL schema with the given schema. - * - * @param BaseSchema $schema - */ - public function addToSchema(BaseSchema $schema) - { - foreach ($this->getTables() as $table) { - $schema->_addTable($table); - } - - foreach ($this->getSequences() as $sequence) { - $schema->_addSequence($sequence); - } - } - - private function addUniqueJobTable() - { - $table = $this->createTable($this->uniqueTableName); - $table->addColumn('name', 'string', ['length' => 255]); - $table->addUniqueIndex(['name']); - } -} diff --git a/pkg/simple-client/SimpleClient.php b/pkg/simple-client/SimpleClient.php index 916f0dbdb..1f1d1d0cf 100644 --- a/pkg/simple-client/SimpleClient.php +++ b/pkg/simple-client/SimpleClient.php @@ -148,22 +148,6 @@ public function sendEvent($topic, $message) $this->getProducer()->sendEvent($topic, $message); } - /** - * @deprecated since 0.8.18 and will be removed in 0.9. Use sendEvent method instead - * - * @param string $topic - * @param string|array $message - * @param bool $setupBroker - */ - public function send($topic, $message, $setupBroker = false) - { - if ($setupBroker) { - $this->setupBroker(); - } - - $this->sendEvent($topic, $message); - } - /** * @param ExtensionInterface|null $runtimeExtension */ diff --git a/pkg/simple-client/Tests/Functional/SimpleClientTest.php b/pkg/simple-client/Tests/Functional/SimpleClientTest.php index 87d60034b..723ee3a38 100644 --- a/pkg/simple-client/Tests/Functional/SimpleClientTest.php +++ b/pkg/simple-client/Tests/Functional/SimpleClientTest.php @@ -112,7 +112,9 @@ public function testProduceAndConsumeOneMessage($config) return Result::ACK; }); - $client->send('foo_topic', 'Hello there!', true); + $client->setupBroker(); + + $client->sendEvent('foo_topic', 'Hello there!'); $client->consume(new ChainExtension([ new LimitConsumptionTimeExtension(new \DateTime('+5sec')), @@ -144,7 +146,9 @@ public function testProduceAndRouteToTwoConsumes($config) return Result::ACK; }); - $client->send('foo_topic', 'Hello there!', true); + $client->setupBroker(); + + $client->sendEvent('foo_topic', 'Hello there!'); $client->consume(new ChainExtension([ new LimitConsumptionTimeExtension(new \DateTime('+5sec')), diff --git a/pkg/sqs/SqsContext.php b/pkg/sqs/SqsContext.php index 57384daaf..d8ace6683 100644 --- a/pkg/sqs/SqsContext.php +++ b/pkg/sqs/SqsContext.php @@ -185,16 +185,6 @@ public function deleteQueue(SqsDestination $dest) unset($this->queueUrls[$dest->getQueueName()]); } - /** - * @deprecated since 0.8 will be removed 0.9 use self::purgeQueue() - * - * @param SqsDestination $dest - */ - public function purge(SqsDestination $dest) - { - $this->purgeQueue($dest); - } - /** * @param SqsDestination $destination */ diff --git a/pkg/sqs/Tests/Functional/SqsConsumptionUseCasesTest.php b/pkg/sqs/Tests/Functional/SqsConsumptionUseCasesTest.php index 490c70ebf..c5ac9ed50 100644 --- a/pkg/sqs/Tests/Functional/SqsConsumptionUseCasesTest.php +++ b/pkg/sqs/Tests/Functional/SqsConsumptionUseCasesTest.php @@ -39,8 +39,8 @@ protected function setUp() $this->context->declareQueue($replyQueue); try { - $this->context->purge($queue); - $this->context->purge($replyQueue); + $this->context->purgeQueue($queue); + $this->context->purgeQueue($replyQueue); } catch (\Exception $e) { } } diff --git a/pkg/sqs/Tests/SqsContextTest.php b/pkg/sqs/Tests/SqsContextTest.php index 2d5b20d30..570e169a1 100644 --- a/pkg/sqs/Tests/SqsContextTest.php +++ b/pkg/sqs/Tests/SqsContextTest.php @@ -187,7 +187,7 @@ public function testShouldAllowPurgeQueue() $queue = $context->createQueue('aQueueName'); - $context->purge($queue); + $context->purgeQueue($queue); } public function testShouldAllowGetQueueUrl()