44
55use Enqueue \AmqpExt \AmqpConsumer ;
66use Enqueue \AmqpExt \AmqpContext ;
7- use Enqueue \AmqpExt \AmqpMessage ;
87use Enqueue \AmqpExt \AmqpProducer ;
9- use Enqueue \AmqpExt \AmqpQueue ;
10- use Enqueue \AmqpExt \AmqpTopic ;
118use Enqueue \AmqpExt \Buffer ;
129use Enqueue \Null \NullQueue ;
1310use Enqueue \Null \NullTopic ;
1411use Enqueue \Test \ClassExtensionTrait ;
12+ use Interop \Amqp \Impl \AmqpMessage ;
13+ use Interop \Amqp \Impl \AmqpQueue ;
14+ use Interop \Amqp \Impl \AmqpTopic ;
1515use Interop \Queue \InvalidDestinationException ;
1616use Interop \Queue \PsrContext ;
1717use 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 */
0 commit comments