Skip to content

Commit 601ba24

Browse files
committed
add subscription consumer specs to amqp pkgs
1 parent b890d9c commit 601ba24

12 files changed

+381
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace Enqueue\AmqpBunny\Tests\Spec;
4+
5+
use Enqueue\AmqpBunny\AmqpConnectionFactory;
6+
use Enqueue\AmqpBunny\AmqpContext;
7+
use Interop\Amqp\AmqpQueue;
8+
use Interop\Queue\PsrContext;
9+
use Interop\Queue\Spec\SubscriptionConsumerConsumeFromAllSubscribedQueuesSpec;
10+
11+
class AmqpSubscriptionConsumerConsumeFromAllSubscribedQueuesTest extends SubscriptionConsumerConsumeFromAllSubscribedQueuesSpec
12+
{
13+
/**
14+
* @return AmqpContext
15+
*
16+
* {@inheritdoc}
17+
*/
18+
protected function createContext()
19+
{
20+
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
21+
22+
$context = $factory->createContext();
23+
$context->setQos(0, 5, false);
24+
25+
return $context;
26+
}
27+
28+
/**
29+
* @param AmqpContext $context
30+
*
31+
* {@inheritdoc}
32+
*/
33+
protected function createQueue(PsrContext $context, $queueName)
34+
{
35+
/** @var AmqpQueue $queue */
36+
$queue = parent::createQueue($context, $queueName);
37+
$context->declareQueue($queue);
38+
$context->purgeQueue($queue);
39+
40+
return $queue;
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace Enqueue\AmqpBunny\Tests\Spec;
4+
5+
use Enqueue\AmqpBunny\AmqpConnectionFactory;
6+
use Interop\Amqp\AmqpContext;
7+
use Interop\Amqp\AmqpQueue;
8+
use Interop\Queue\PsrContext;
9+
use Interop\Queue\Spec\SubscriptionConsumerConsumeUntilUnsubscribedSpec;
10+
11+
class AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest extends SubscriptionConsumerConsumeUntilUnsubscribedSpec
12+
{
13+
/**
14+
* @return AmqpContext
15+
*
16+
* {@inheritdoc}
17+
*/
18+
protected function createContext()
19+
{
20+
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
21+
22+
$context = $factory->createContext();
23+
$context->setQos(0, 5, false);
24+
25+
return $context;
26+
}
27+
28+
/**
29+
* @param AmqpContext $context
30+
*
31+
* {@inheritdoc}
32+
*/
33+
protected function createQueue(PsrContext $context, $queueName)
34+
{
35+
/** @var AmqpQueue $queue */
36+
$queue = parent::createQueue($context, $queueName);
37+
$context->declareQueue($queue);
38+
$context->purgeQueue($queue);
39+
40+
return $queue;
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace Enqueue\AmqpBunny\Tests\Spec;
4+
5+
use Enqueue\AmqpBunny\AmqpConnectionFactory;
6+
use Interop\Amqp\AmqpContext;
7+
use Interop\Amqp\AmqpQueue;
8+
use Interop\Queue\PsrContext;
9+
use Interop\Queue\Spec\SubscriptionConsumerStopOnFalseSpec;
10+
11+
class AmqpSubscriptionConsumerStopOnFalseTest extends SubscriptionConsumerStopOnFalseSpec
12+
{
13+
/**
14+
* @return AmqpContext
15+
*
16+
* {@inheritdoc}
17+
*/
18+
protected function createContext()
19+
{
20+
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
21+
22+
$context = $factory->createContext();
23+
$context->setQos(0, 5, false);
24+
25+
return $context;
26+
}
27+
28+
/**
29+
* @param AmqpContext $context
30+
*
31+
* {@inheritdoc}
32+
*/
33+
protected function createQueue(PsrContext $context, $queueName)
34+
{
35+
/** @var AmqpQueue $queue */
36+
$queue = parent::createQueue($context, $queueName);
37+
$context->declareQueue($queue);
38+
$context->purgeQueue($queue);
39+
40+
return $queue;
41+
}
42+
}

pkg/amqp-bunny/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"enqueue/test": "0.9.x-dev",
1717
"enqueue/enqueue": "0.9.x-dev",
1818
"enqueue/null": "0.9.x-dev",
19-
"queue-interop/queue-spec": "^0.5.3@dev",
19+
"queue-interop/queue-spec": "^0.5.8@dev",
2020
"symfony/dependency-injection": "^3.4|^4",
2121
"symfony/config": "^3.4|^4"
2222
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace Enqueue\AmqpExt\Tests\Spec;
4+
5+
use Enqueue\AmqpExt\AmqpConnectionFactory;
6+
use Enqueue\AmqpExt\AmqpContext;
7+
use Interop\Amqp\AmqpQueue;
8+
use Interop\Queue\PsrContext;
9+
use Interop\Queue\Spec\SubscriptionConsumerConsumeFromAllSubscribedQueuesSpec;
10+
11+
class AmqpSubscriptionConsumerConsumeFromAllSubscribedQueuesTest extends SubscriptionConsumerConsumeFromAllSubscribedQueuesSpec
12+
{
13+
/**
14+
* @return AmqpContext
15+
*
16+
* {@inheritdoc}
17+
*/
18+
protected function createContext()
19+
{
20+
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
21+
22+
$context = $factory->createContext();
23+
$context->setQos(0, 5, false);
24+
25+
return $context;
26+
}
27+
28+
/**
29+
* @param AmqpContext $context
30+
*
31+
* {@inheritdoc}
32+
*/
33+
protected function createQueue(PsrContext $context, $queueName)
34+
{
35+
/** @var AmqpQueue $queue */
36+
$queue = parent::createQueue($context, $queueName);
37+
$context->declareQueue($queue);
38+
$context->purgeQueue($queue);
39+
40+
return $queue;
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace Enqueue\AmqpExt\Tests\Spec;
4+
5+
use Enqueue\AmqpExt\AmqpConnectionFactory;
6+
use Interop\Amqp\AmqpContext;
7+
use Interop\Amqp\AmqpQueue;
8+
use Interop\Queue\PsrContext;
9+
use Interop\Queue\Spec\SubscriptionConsumerConsumeUntilUnsubscribedSpec;
10+
11+
class AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest extends SubscriptionConsumerConsumeUntilUnsubscribedSpec
12+
{
13+
/**
14+
* @return AmqpContext
15+
*
16+
* {@inheritdoc}
17+
*/
18+
protected function createContext()
19+
{
20+
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
21+
22+
$context = $factory->createContext();
23+
$context->setQos(0, 5, false);
24+
25+
return $context;
26+
}
27+
28+
/**
29+
* @param AmqpContext $context
30+
*
31+
* {@inheritdoc}
32+
*/
33+
protected function createQueue(PsrContext $context, $queueName)
34+
{
35+
/** @var AmqpQueue $queue */
36+
$queue = parent::createQueue($context, $queueName);
37+
$context->declareQueue($queue);
38+
$context->purgeQueue($queue);
39+
40+
return $queue;
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace Enqueue\AmqpExt\Tests\Spec;
4+
5+
use Enqueue\AmqpExt\AmqpConnectionFactory;
6+
use Interop\Amqp\AmqpContext;
7+
use Interop\Amqp\AmqpQueue;
8+
use Interop\Queue\PsrContext;
9+
use Interop\Queue\Spec\SubscriptionConsumerStopOnFalseSpec;
10+
11+
class AmqpSubscriptionConsumerStopOnFalseTest extends SubscriptionConsumerStopOnFalseSpec
12+
{
13+
/**
14+
* @return AmqpContext
15+
*
16+
* {@inheritdoc}
17+
*/
18+
protected function createContext()
19+
{
20+
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
21+
22+
$context = $factory->createContext();
23+
$context->setQos(0, 5, false);
24+
25+
return $context;
26+
}
27+
28+
/**
29+
* @param AmqpContext $context
30+
*
31+
* {@inheritdoc}
32+
*/
33+
protected function createQueue(PsrContext $context, $queueName)
34+
{
35+
/** @var AmqpQueue $queue */
36+
$queue = parent::createQueue($context, $queueName);
37+
$context->declareQueue($queue);
38+
$context->purgeQueue($queue);
39+
40+
return $queue;
41+
}
42+
}

pkg/amqp-ext/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"enqueue/test": "0.9.x-dev",
1717
"enqueue/enqueue": "0.9.x-dev",
1818
"enqueue/null": "0.9.x-dev",
19-
"queue-interop/queue-spec": "^0.5.3@dev",
19+
"queue-interop/queue-spec": "^0.5.8@dev",
2020
"empi89/php-amqp-stubs": "*@dev",
2121
"symfony/dependency-injection": "^3.4|^4",
2222
"symfony/config": "^3.4|^4"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace Enqueue\AmqpLib\Tests\Spec;
4+
5+
use Enqueue\AmqpLib\AmqpConnectionFactory;
6+
use Enqueue\AmqpLib\AmqpContext;
7+
use Interop\Amqp\AmqpQueue;
8+
use Interop\Queue\PsrContext;
9+
use Interop\Queue\Spec\SubscriptionConsumerConsumeFromAllSubscribedQueuesSpec;
10+
11+
class AmqpSubscriptionConsumerConsumeFromAllSubscribedQueuesTest extends SubscriptionConsumerConsumeFromAllSubscribedQueuesSpec
12+
{
13+
/**
14+
* @return AmqpContext
15+
*
16+
* {@inheritdoc}
17+
*/
18+
protected function createContext()
19+
{
20+
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
21+
22+
$context = $factory->createContext();
23+
$context->setQos(0, 5, false);
24+
25+
return $context;
26+
}
27+
28+
/**
29+
* @param AmqpContext $context
30+
*
31+
* {@inheritdoc}
32+
*/
33+
protected function createQueue(PsrContext $context, $queueName)
34+
{
35+
/** @var AmqpQueue $queue */
36+
$queue = parent::createQueue($context, $queueName);
37+
$context->declareQueue($queue);
38+
$context->purgeQueue($queue);
39+
40+
return $queue;
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace Enqueue\AmqpLib\Tests\Spec;
4+
5+
use Enqueue\AmqpLib\AmqpConnectionFactory;
6+
use Interop\Amqp\AmqpContext;
7+
use Interop\Amqp\AmqpQueue;
8+
use Interop\Queue\PsrContext;
9+
use Interop\Queue\Spec\SubscriptionConsumerConsumeUntilUnsubscribedSpec;
10+
11+
class AmqpSubscriptionConsumerConsumeUntilUnsubscribedTest extends SubscriptionConsumerConsumeUntilUnsubscribedSpec
12+
{
13+
/**
14+
* @return AmqpContext
15+
*
16+
* {@inheritdoc}
17+
*/
18+
protected function createContext()
19+
{
20+
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN'));
21+
22+
$context = $factory->createContext();
23+
$context->setQos(0, 5, false);
24+
25+
return $context;
26+
}
27+
28+
/**
29+
* @param AmqpContext $context
30+
*
31+
* {@inheritdoc}
32+
*/
33+
protected function createQueue(PsrContext $context, $queueName)
34+
{
35+
/** @var AmqpQueue $queue */
36+
$queue = parent::createQueue($context, $queueName);
37+
$context->declareQueue($queue);
38+
$context->purgeQueue($queue);
39+
40+
return $queue;
41+
}
42+
}

0 commit comments

Comments
 (0)