Skip to content

Commit 259f204

Browse files
committed
separate tests for basic_get and basic_consume
1 parent 9aba09d commit 259f204

2 files changed

Lines changed: 60 additions & 1 deletion

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
namespace Enqueue\AmqpLib\Tests\Spec;
4+
5+
use Enqueue\AmqpLib\AmqpConnectionFactory;
6+
use Enqueue\AmqpLib\AmqpContext;
7+
use Interop\Queue\PsrContext;
8+
use Interop\Queue\Spec\SendToTopicAndReceiveFromQueueSpec;
9+
10+
/**
11+
* @group functional
12+
*/
13+
class AmqpSendToTopicAndReceiveFromQueueTest extends SendToTopicAndReceiveFromQueueSpec
14+
{
15+
/**
16+
* {@inheritdoc}
17+
*/
18+
protected function createContext()
19+
{
20+
$factory = new AmqpConnectionFactory(getenv('AMQP_DSN').'?receive_method=basic_consume');
21+
22+
return $factory->createContext();
23+
}
24+
25+
/**
26+
* {@inheritdoc}
27+
*
28+
* @param AmqpContext $context
29+
*/
30+
protected function createQueue(PsrContext $context, $queueName)
31+
{
32+
$queueName .= '_basic_consume';
33+
34+
$queue = $context->createQueue($queueName);
35+
$context->declareQueue($queue);
36+
$context->purge($queue);
37+
38+
$context->bind($context->createTopic($queueName), $queue);
39+
40+
return $queue;
41+
}
42+
43+
/**
44+
* {@inheritdoc}
45+
*
46+
* @param AmqpContext $context
47+
*/
48+
protected function createTopic(PsrContext $context, $topicName)
49+
{
50+
$topicName .= '_basic_consume';
51+
52+
$topic = $context->createTopic($topicName);
53+
$topic->setType('fanout');
54+
$topic->setDurable(true);
55+
$context->declareTopic($topic);
56+
57+
return $topic;
58+
}
59+
}

pkg/amqp-lib/Tests/Spec/AmqpSendToTopicAndReceiveFromQueueTest.php renamed to pkg/amqp-lib/Tests/Spec/AmqpSendToTopicAndReceiveFromQueueWithBasicGetMethodTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* @group functional
1212
*/
13-
class AmqpSendToTopicAndReceiveFromQueueTest extends SendToTopicAndReceiveFromQueueSpec
13+
class AmqpSendToTopicAndReceiveFromQueueWithBasicGetMethodTest extends SendToTopicAndReceiveFromQueueSpec
1414
{
1515
/**
1616
* {@inheritdoc}

0 commit comments

Comments
 (0)