Skip to content

Commit ec620dd

Browse files
committed
fix tests
1 parent e178d9e commit ec620dd

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎pkg/amqp-lib/Tests/Spec/AmqpSendToTopicAndReceiveFromQueueWithBasicConsumeMethodTest.php‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Interop\Amqp\AmqpTopic;
88
use Interop\Amqp\Impl\AmqpBind;
99
use Interop\Queue\PsrContext;
10+
use Interop\Queue\PsrMessage;
1011
use Interop\Queue\Spec\SendToTopicAndReceiveFromQueueSpec;
1112

1213
/**
@@ -26,6 +27,31 @@ protected function createContext()
2627
return $factory->createContext();
2728
}
2829

30+
public function test()
31+
{
32+
$context = $this->createContext();
33+
$topic = $this->createTopic($context, 'send_to_topic_and_receive_from_queue_spec');
34+
$queue = $this->createQueue($context, 'send_to_topic_and_receive_from_queue_spec');
35+
36+
$consumer = $context->createConsumer($queue);
37+
38+
// guard
39+
$this->assertNull($consumer->receiveNoWait());
40+
41+
$expectedBody = __CLASS__.time();
42+
43+
$context->createProducer()->send($topic, $context->createMessage($expectedBody));
44+
45+
$message = $consumer->receive(10000); // 2 sec
46+
47+
var_dump($message);
48+
49+
$this->assertInstanceOf(PsrMessage::class, $message);
50+
$consumer->acknowledge($message);
51+
52+
$this->assertSame($expectedBody, $message->getBody());
53+
}
54+
2955
/**
3056
* {@inheritdoc}
3157
*

0 commit comments

Comments
 (0)