1212use Enqueue \Psr \PsrContext ;
1313use Enqueue \Psr \InvalidDestinationException ;
1414use Enqueue \Test \ClassExtensionTrait ;
15- use Enqueue \Transport \ Null \NullQueue ;
16- use Enqueue \Transport \ Null \NullTopic ;
15+ use Enqueue \Null \NullQueue ;
16+ use Enqueue \Null \NullTopic ;
1717use PHPUnit \Framework \TestCase ;
1818
1919class AmqpContextTest extends TestCase
@@ -96,7 +96,7 @@ public function testShouldThrowIfNotAmqpTopicGivenOnDeleteTopicCall()
9696 $ context = new AmqpContext ($ this ->createExtChannelMock ());
9797
9898 $ this ->expectException (InvalidDestinationException::class);
99- $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpTopic but got Enqueue\Transport\ Null\NullTopic. ' );
99+ $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpTopic but got Enqueue\Null\NullTopic. ' );
100100 $ context ->deleteTopic (new NullTopic ('aName ' ));
101101 }
102102
@@ -105,7 +105,7 @@ public function testShouldThrowIfNotAmqpTopicGivenOnDeclareTopicCall()
105105 $ context = new AmqpContext ($ this ->createExtChannelMock ());
106106
107107 $ this ->expectException (InvalidDestinationException::class);
108- $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpTopic but got Enqueue\Transport\ Null\NullTopic. ' );
108+ $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpTopic but got Enqueue\Null\NullTopic. ' );
109109 $ context ->declareTopic (new NullTopic ('aName ' ));
110110 }
111111
@@ -128,7 +128,7 @@ public function testShouldThrowIfNotAmqpQueueGivenOnDeleteQueueCall()
128128 $ context = new AmqpContext ($ this ->createExtChannelMock ());
129129
130130 $ this ->expectException (InvalidDestinationException::class);
131- $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Transport\ Null\NullQueue. ' );
131+ $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Null\NullQueue. ' );
132132 $ context ->deleteQueue (new NullQueue ('aName ' ));
133133 }
134134
@@ -137,7 +137,7 @@ public function testShouldThrowIfNotAmqpQueueGivenOnDeclareQueueCall()
137137 $ context = new AmqpContext ($ this ->createExtChannelMock ());
138138
139139 $ this ->expectException (InvalidDestinationException::class);
140- $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Transport\ Null\NullQueue. ' );
140+ $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Null\NullQueue. ' );
141141 $ context ->declareQueue (new NullQueue ('aName ' ));
142142 }
143143
@@ -172,7 +172,7 @@ public function testShouldThrowIfNotAmqpQueueGivenOnCreateConsumerCall()
172172 $ context = new AmqpContext ($ this ->createExtChannelMock ());
173173
174174 $ this ->expectException (InvalidDestinationException::class);
175- $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Transport\ Null\NullQueue. ' );
175+ $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Null\NullQueue. ' );
176176 $ context ->createConsumer (new NullQueue ('aName ' ));
177177 }
178178
@@ -181,7 +181,7 @@ public function testShouldThrowIfNotAmqpTopicGivenOnCreateConsumerCall()
181181 $ context = new AmqpContext ($ this ->createExtChannelMock ());
182182
183183 $ this ->expectException (InvalidDestinationException::class);
184- $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpTopic but got Enqueue\Transport\ Null\NullTopic. ' );
184+ $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpTopic but got Enqueue\Null\NullTopic. ' );
185185 $ context ->createConsumer (new NullTopic ('aName ' ));
186186 }
187187
@@ -291,7 +291,7 @@ public function testShouldThrowIfSourceNotAmqpTopicOnBindCall()
291291 $ context = new AmqpContext ($ this ->createExtChannelMock ());
292292
293293 $ this ->expectException (InvalidDestinationException::class);
294- $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpTopic but got Enqueue\Transport\ Null\NullTopic. ' );
294+ $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpTopic but got Enqueue\Null\NullTopic. ' );
295295 $ context ->bind (new NullTopic ('aName ' ), new AmqpQueue ('aName ' ));
296296 }
297297
@@ -300,7 +300,7 @@ public function testShouldThrowIfTargetNotAmqpQueueOnBindCall()
300300 $ context = new AmqpContext ($ this ->createExtChannelMock ());
301301
302302 $ this ->expectException (InvalidDestinationException::class);
303- $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Transport\ Null\NullQueue. ' );
303+ $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Null\NullQueue. ' );
304304 $ context ->bind (new AmqpTopic ('aName ' ), new NullQueue ('aName ' ));
305305 }
306306
@@ -309,7 +309,7 @@ public function testShouldThrowIfGivenQueueNotAmqpQueueOnPurge()
309309 $ context = new AmqpContext ($ this ->createExtChannelMock ());
310310
311311 $ this ->expectException (InvalidDestinationException::class);
312- $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Transport\ Null\NullQueue. ' );
312+ $ this ->expectExceptionMessage ('The destination must be an instance of Enqueue\AmqpExt\AmqpQueue but got Enqueue\Null\NullQueue. ' );
313313 $ context ->purge (new NullQueue ('aName ' ));
314314 }
315315
@@ -326,6 +326,9 @@ private function createExtChannelMock()
326326 */
327327 private function createExtConnectionMock ()
328328 {
329- return $ this ->createMock (\AMQPConnection::class);
329+ return $ this ->getMockBuilder (\AMQPConnection::class)
330+ ->setMethods (['isPersistent ' , 'isConnected ' , 'pdisconnect ' , 'disconnect ' ])
331+ ->getMock ()
332+ ;
330333 }
331334}
0 commit comments