Skip to content

Commit 25c511f

Browse files
committed
amqp ext interop
1 parent bb789a7 commit 25c511f

17 files changed

Lines changed: 49 additions & 445 deletions

‎pkg/amqp-ext/Tests/AmqpConsumerTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
use Enqueue\AmqpExt\AmqpConsumer;
66
use Enqueue\AmqpExt\AmqpContext;
7-
use Enqueue\AmqpExt\AmqpQueue;
87
use Enqueue\AmqpExt\Buffer;
98
use Enqueue\Test\ClassExtensionTrait;
9+
use Interop\Amqp\Impl\AmqpQueue;
1010
use Interop\Queue\PsrConsumer;
1111
use PHPUnit\Framework\TestCase;
1212

‎pkg/amqp-ext/Tests/AmqpContextTest.php‎

Lines changed: 8 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
use Enqueue\AmqpExt\AmqpConsumer;
66
use Enqueue\AmqpExt\AmqpContext;
7-
use Enqueue\AmqpExt\AmqpMessage;
87
use Enqueue\AmqpExt\AmqpProducer;
9-
use Enqueue\AmqpExt\AmqpQueue;
10-
use Enqueue\AmqpExt\AmqpTopic;
118
use Enqueue\AmqpExt\Buffer;
129
use Enqueue\Null\NullQueue;
1310
use Enqueue\Null\NullTopic;
1411
use Enqueue\Test\ClassExtensionTrait;
12+
use Interop\Amqp\Impl\AmqpMessage;
13+
use Interop\Amqp\Impl\AmqpQueue;
14+
use Interop\Amqp\Impl\AmqpTopic;
1515
use Interop\Queue\InvalidDestinationException;
1616
use Interop\Queue\PsrContext;
1717
use PHPUnit\Framework\TestCase;
@@ -86,27 +86,8 @@ public function testShouldCreateTopicWithGivenName()
8686

8787
$this->assertInstanceOf(AmqpTopic::class, $topic);
8888
$this->assertSame('theName', $topic->getTopicName());
89-
$this->assertSame(\AMQP_NOPARAM, $topic->getFlags());
89+
$this->assertSame(AmqpTopic::FLAG_NOPARAM, $topic->getFlags());
9090
$this->assertSame([], $topic->getArguments());
91-
$this->assertSame(null, $topic->getRoutingKey());
92-
}
93-
94-
public function testShouldThrowIfNotAmqpTopicGivenOnDeleteTopicCall()
95-
{
96-
$context = new AmqpContext($this->createExtChannelMock(), 'basic_get');
97-
98-
$this->expectException(InvalidDestinationException::class);
99-
$this->expectExceptionMessage('The destination must be an instance of Enqueue\AmqpExt\AmqpTopic but got Enqueue\Null\NullTopic.');
100-
$context->deleteTopic(new NullTopic('aName'));
101-
}
102-
103-
public function testShouldThrowIfNotAmqpTopicGivenOnDeclareTopicCall()
104-
{
105-
$context = new AmqpContext($this->createExtChannelMock(), 'basic_get');
106-
107-
$this->expectException(InvalidDestinationException::class);
108-
$this->expectExceptionMessage('The destination must be an instance of Enqueue\AmqpExt\AmqpTopic but got Enqueue\Null\NullTopic.');
109-
$context->declareTopic(new NullTopic('aName'));
11091
}
11192

11293
public function testShouldCreateQueueWithGivenName()
@@ -117,30 +98,11 @@ public function testShouldCreateQueueWithGivenName()
11798

11899
$this->assertInstanceOf(AmqpQueue::class, $queue);
119100
$this->assertSame('theName', $queue->getQueueName());
120-
$this->assertSame(\AMQP_NOPARAM, $queue->getFlags());
101+
$this->assertSame(AmqpQueue::FLAG_NOPARAM, $queue->getFlags());
121102
$this->assertSame([], $queue->getArguments());
122-
$this->assertSame([], $queue->getBindArguments());
123103
$this->assertSame(null, $queue->getConsumerTag());
124104
}
125105

126-
public function testShouldThrowIfNotAmqpQueueGivenOnDeleteQueueCall()
127-
{
128-
$context = new AmqpContext($this->createExtChannelMock(), 'basic_get');
129-
130-
$this->expectException(InvalidDestinationException::class);
131-
$this->expectExceptionMessage('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Null\NullQueue.');
132-
$context->deleteQueue(new NullQueue('aName'));
133-
}
134-
135-
public function testShouldThrowIfNotAmqpQueueGivenOnDeclareQueueCall()
136-
{
137-
$context = new AmqpContext($this->createExtChannelMock(), 'basic_get');
138-
139-
$this->expectException(InvalidDestinationException::class);
140-
$this->expectExceptionMessage('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Null\NullQueue.');
141-
$context->declareQueue(new NullQueue('aName'));
142-
}
143-
144106
public function testShouldReturnAmqpProducer()
145107
{
146108
$context = new AmqpContext($this->createExtChannelMock(), 'basic_get');
@@ -172,7 +134,7 @@ public function testShouldThrowIfNotAmqpQueueGivenOnCreateConsumerCall()
172134
$context = new AmqpContext($this->createExtChannelMock(), 'basic_get');
173135

174136
$this->expectException(InvalidDestinationException::class);
175-
$this->expectExceptionMessage('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Null\NullQueue.');
137+
$this->expectExceptionMessage('The destination must be an instance of Interop\Amqp\AmqpQueue but got Enqueue\Null\NullQueue.');
176138
$context->createConsumer(new NullQueue('aName'));
177139
}
178140

@@ -181,11 +143,11 @@ public function testShouldThrowIfNotAmqpTopicGivenOnCreateConsumerCall()
181143
$context = new AmqpContext($this->createExtChannelMock(), 'basic_get');
182144

183145
$this->expectException(InvalidDestinationException::class);
184-
$this->expectExceptionMessage('The destination must be an instance of Enqueue\AmqpExt\AmqpTopic but got Enqueue\Null\NullTopic.');
146+
$this->expectExceptionMessage('The destination must be an instance of Interop\Amqp\AmqpTopic but got Enqueue\Null\NullTopic.');
185147
$context->createConsumer(new NullTopic('aName'));
186148
}
187149

188-
public function shouldDoNothingIfConnectionAlreadyClosed()
150+
public function testShouldDoNothingIfConnectionAlreadyClosed()
189151
{
190152
$extConnectionMock = $this->createExtConnectionMock();
191153
$extConnectionMock
@@ -286,33 +248,6 @@ public function testShouldClosePersistedConnection()
286248
$context->close();
287249
}
288250

289-
public function testShouldThrowIfSourceNotAmqpTopicOnBindCall()
290-
{
291-
$context = new AmqpContext($this->createExtChannelMock(), 'basic_get');
292-
293-
$this->expectException(InvalidDestinationException::class);
294-
$this->expectExceptionMessage('The destination must be an instance of Enqueue\AmqpExt\AmqpTopic but got Enqueue\Null\NullTopic.');
295-
$context->bind(new NullTopic('aName'), new AmqpQueue('aName'));
296-
}
297-
298-
public function testShouldThrowIfTargetNotAmqpQueueOnBindCall()
299-
{
300-
$context = new AmqpContext($this->createExtChannelMock(), 'basic_get');
301-
302-
$this->expectException(InvalidDestinationException::class);
303-
$this->expectExceptionMessage('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Null\NullQueue.');
304-
$context->bind(new AmqpTopic('aName'), new NullQueue('aName'));
305-
}
306-
307-
public function testShouldThrowIfGivenQueueNotAmqpQueueOnPurge()
308-
{
309-
$context = new AmqpContext($this->createExtChannelMock(), 'basic_get');
310-
311-
$this->expectException(InvalidDestinationException::class);
312-
$this->expectExceptionMessage('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Null\NullQueue.');
313-
$context->purge(new NullQueue('aName'));
314-
}
315-
316251
/**
317252
* @return \PHPUnit_Framework_MockObject_MockObject|\AMQPChannel
318253
*/

‎pkg/amqp-ext/Tests/AmqpMessageTest.php‎

Lines changed: 0 additions & 118 deletions
This file was deleted.

‎pkg/amqp-ext/Tests/AmqpQueueTest.php‎

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)