Skip to content

add subscription consumer specs to amqp pkgs #495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Enqueue\AmqpBunny\Tests\Spec;

use Enqueue\AmqpBunny\AmqpConnectionFactory;
use Enqueue\AmqpBunny\AmqpContext;
use Interop\Amqp\AmqpQueue;
use Interop\Queue\PsrContext;
use Interop\Queue\Spec\SubscriptionConsumerConsumeFromAllSubscribedQueuesSpec;

class AmqpSubscriptionConsumerConsumeFromAllSubscribedQueuesTest extends SubscriptionConsumerConsumeFromAllSubscribedQueuesSpec
{
/**
* @return AmqpContext
*
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));

$context = $factory->createContext();
$context->setQos(0, 5, false);

return $context;
}

/**
* @param AmqpContext $context
*
* {@inheritdoc}
*/
protected function createQueue(PsrContext $context, $queueName)
{
/** @var AmqpQueue $queue */
$queue = parent::createQueue($context, $queueName);
$context->declareQueue($queue);
$context->purgeQueue($queue);

return $queue;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Enqueue\AmqpBunny\Tests\Spec;

use Enqueue\AmqpBunny\AmqpConnectionFactory;
use Interop\Amqp\AmqpContext;
use Interop\Amqp\AmqpQueue;
use Interop\Queue\PsrContext;
use Interop\Queue\Spec\SubscriptionConsumerConsumeUntilUnsubscribedSpec;

class AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest extends SubscriptionConsumerConsumeUntilUnsubscribedSpec
{
/**
* @return AmqpContext
*
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));

$context = $factory->createContext();
$context->setQos(0, 5, false);

return $context;
}

/**
* @param AmqpContext $context
*
* {@inheritdoc}
*/
protected function createQueue(PsrContext $context, $queueName)
{
/** @var AmqpQueue $queue */
$queue = parent::createQueue($context, $queueName);
$context->declareQueue($queue);
$context->purgeQueue($queue);

return $queue;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Enqueue\AmqpBunny\Tests\Spec;

use Enqueue\AmqpBunny\AmqpConnectionFactory;
use Interop\Amqp\AmqpContext;
use Interop\Amqp\AmqpQueue;
use Interop\Queue\PsrContext;
use Interop\Queue\Spec\SubscriptionConsumerStopOnFalseSpec;

class AmqpSubscriptionConsumerStopOnFalseTest extends SubscriptionConsumerStopOnFalseSpec
{
/**
* @return AmqpContext
*
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));

$context = $factory->createContext();
$context->setQos(0, 5, false);

return $context;
}

/**
* @param AmqpContext $context
*
* {@inheritdoc}
*/
protected function createQueue(PsrContext $context, $queueName)
{
/** @var AmqpQueue $queue */
$queue = parent::createQueue($context, $queueName);
$context->declareQueue($queue);
$context->purgeQueue($queue);

return $queue;
}
}
2 changes: 1 addition & 1 deletion pkg/amqp-bunny/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.3@dev",
"queue-interop/queue-spec": "^0.5.8@dev",
"symfony/dependency-injection": "^3.4|^4",
"symfony/config": "^3.4|^4"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Enqueue\AmqpExt\Tests\Spec;

use Enqueue\AmqpExt\AmqpConnectionFactory;
use Enqueue\AmqpExt\AmqpContext;
use Interop\Amqp\AmqpQueue;
use Interop\Queue\PsrContext;
use Interop\Queue\Spec\SubscriptionConsumerConsumeFromAllSubscribedQueuesSpec;

class AmqpSubscriptionConsumerConsumeFromAllSubscribedQueuesTest extends SubscriptionConsumerConsumeFromAllSubscribedQueuesSpec
{
/**
* @return AmqpContext
*
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));

$context = $factory->createContext();
$context->setQos(0, 5, false);

return $context;
}

/**
* @param AmqpContext $context
*
* {@inheritdoc}
*/
protected function createQueue(PsrContext $context, $queueName)
{
/** @var AmqpQueue $queue */
$queue = parent::createQueue($context, $queueName);
$context->declareQueue($queue);
$context->purgeQueue($queue);

return $queue;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Enqueue\AmqpExt\Tests\Spec;

use Enqueue\AmqpExt\AmqpConnectionFactory;
use Interop\Amqp\AmqpContext;
use Interop\Amqp\AmqpQueue;
use Interop\Queue\PsrContext;
use Interop\Queue\Spec\SubscriptionConsumerConsumeUntilUnsubscribedSpec;

class AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest extends SubscriptionConsumerConsumeUntilUnsubscribedSpec
{
/**
* @return AmqpContext
*
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));

$context = $factory->createContext();
$context->setQos(0, 5, false);

return $context;
}

/**
* @param AmqpContext $context
*
* {@inheritdoc}
*/
protected function createQueue(PsrContext $context, $queueName)
{
/** @var AmqpQueue $queue */
$queue = parent::createQueue($context, $queueName);
$context->declareQueue($queue);
$context->purgeQueue($queue);

return $queue;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Enqueue\AmqpExt\Tests\Spec;

use Enqueue\AmqpExt\AmqpConnectionFactory;
use Interop\Amqp\AmqpContext;
use Interop\Amqp\AmqpQueue;
use Interop\Queue\PsrContext;
use Interop\Queue\Spec\SubscriptionConsumerStopOnFalseSpec;

class AmqpSubscriptionConsumerStopOnFalseTest extends SubscriptionConsumerStopOnFalseSpec
{
/**
* @return AmqpContext
*
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));

$context = $factory->createContext();
$context->setQos(0, 5, false);

return $context;
}

/**
* @param AmqpContext $context
*
* {@inheritdoc}
*/
protected function createQueue(PsrContext $context, $queueName)
{
/** @var AmqpQueue $queue */
$queue = parent::createQueue($context, $queueName);
$context->declareQueue($queue);
$context->purgeQueue($queue);

return $queue;
}
}
2 changes: 1 addition & 1 deletion pkg/amqp-ext/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.3@dev",
"queue-interop/queue-spec": "^0.5.8@dev",
"empi89/php-amqp-stubs": "*@dev",
"symfony/dependency-injection": "^3.4|^4",
"symfony/config": "^3.4|^4"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Enqueue\AmqpLib\Tests\Spec;

use Enqueue\AmqpLib\AmqpConnectionFactory;
use Enqueue\AmqpLib\AmqpContext;
use Interop\Amqp\AmqpQueue;
use Interop\Queue\PsrContext;
use Interop\Queue\Spec\SubscriptionConsumerConsumeFromAllSubscribedQueuesSpec;

class AmqpSubscriptionConsumerConsumeFromAllSubscribedQueuesTest extends SubscriptionConsumerConsumeFromAllSubscribedQueuesSpec
{
/**
* @return AmqpContext
*
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));

$context = $factory->createContext();
$context->setQos(0, 5, false);

return $context;
}

/**
* @param AmqpContext $context
*
* {@inheritdoc}
*/
protected function createQueue(PsrContext $context, $queueName)
{
/** @var AmqpQueue $queue */
$queue = parent::createQueue($context, $queueName);
$context->declareQueue($queue);
$context->purgeQueue($queue);

return $queue;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Enqueue\AmqpLib\Tests\Spec;

use Enqueue\AmqpLib\AmqpConnectionFactory;
use Interop\Amqp\AmqpContext;
use Interop\Amqp\AmqpQueue;
use Interop\Queue\PsrContext;
use Interop\Queue\Spec\SubscriptionConsumerConsumeUntilUnsubscribedSpec;

class AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest extends SubscriptionConsumerConsumeUntilUnsubscribedSpec
{
/**
* @return AmqpContext
*
* {@inheritdoc}
*/
protected function createContext()
{
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));

$context = $factory->createContext();
$context->setQos(0, 5, false);

return $context;
}

/**
* @param AmqpContext $context
*
* {@inheritdoc}
*/
protected function createQueue(PsrContext $context, $queueName)
{
/** @var AmqpQueue $queue */
$queue = parent::createQueue($context, $queueName);
$context->declareQueue($queue);
$context->purgeQueue($queue);

return $queue;
}
}
Loading