12
12
use Enqueue \Psr \PsrContext ;
13
13
use Enqueue \Psr \InvalidDestinationException ;
14
14
use 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 ;
17
17
use PHPUnit \Framework \TestCase ;
18
18
19
19
class AmqpContextTest extends TestCase
@@ -96,7 +96,7 @@ public function testShouldThrowIfNotAmqpTopicGivenOnDeleteTopicCall()
96
96
$ context = new AmqpContext ($ this ->createExtChannelMock ());
97
97
98
98
$ 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. ' );
100
100
$ context ->deleteTopic (new NullTopic ('aName ' ));
101
101
}
102
102
@@ -105,7 +105,7 @@ public function testShouldThrowIfNotAmqpTopicGivenOnDeclareTopicCall()
105
105
$ context = new AmqpContext ($ this ->createExtChannelMock ());
106
106
107
107
$ 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. ' );
109
109
$ context ->declareTopic (new NullTopic ('aName ' ));
110
110
}
111
111
@@ -128,7 +128,7 @@ public function testShouldThrowIfNotAmqpQueueGivenOnDeleteQueueCall()
128
128
$ context = new AmqpContext ($ this ->createExtChannelMock ());
129
129
130
130
$ 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. ' );
132
132
$ context ->deleteQueue (new NullQueue ('aName ' ));
133
133
}
134
134
@@ -137,7 +137,7 @@ public function testShouldThrowIfNotAmqpQueueGivenOnDeclareQueueCall()
137
137
$ context = new AmqpContext ($ this ->createExtChannelMock ());
138
138
139
139
$ 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. ' );
141
141
$ context ->declareQueue (new NullQueue ('aName ' ));
142
142
}
143
143
@@ -172,7 +172,7 @@ public function testShouldThrowIfNotAmqpQueueGivenOnCreateConsumerCall()
172
172
$ context = new AmqpContext ($ this ->createExtChannelMock ());
173
173
174
174
$ 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. ' );
176
176
$ context ->createConsumer (new NullQueue ('aName ' ));
177
177
}
178
178
@@ -181,7 +181,7 @@ public function testShouldThrowIfNotAmqpTopicGivenOnCreateConsumerCall()
181
181
$ context = new AmqpContext ($ this ->createExtChannelMock ());
182
182
183
183
$ 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. ' );
185
185
$ context ->createConsumer (new NullTopic ('aName ' ));
186
186
}
187
187
@@ -291,7 +291,7 @@ public function testShouldThrowIfSourceNotAmqpTopicOnBindCall()
291
291
$ context = new AmqpContext ($ this ->createExtChannelMock ());
292
292
293
293
$ 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. ' );
295
295
$ context ->bind (new NullTopic ('aName ' ), new AmqpQueue ('aName ' ));
296
296
}
297
297
@@ -300,7 +300,7 @@ public function testShouldThrowIfTargetNotAmqpQueueOnBindCall()
300
300
$ context = new AmqpContext ($ this ->createExtChannelMock ());
301
301
302
302
$ 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. ' );
304
304
$ context ->bind (new AmqpTopic ('aName ' ), new NullQueue ('aName ' ));
305
305
}
306
306
@@ -309,7 +309,7 @@ public function testShouldThrowIfGivenQueueNotAmqpQueueOnPurge()
309
309
$ context = new AmqpContext ($ this ->createExtChannelMock ());
310
310
311
311
$ 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. ' );
313
313
$ context ->purge (new NullQueue ('aName ' ));
314
314
}
315
315
@@ -326,6 +326,9 @@ private function createExtChannelMock()
326
326
*/
327
327
private function createExtConnectionMock ()
328
328
{
329
- return $ this ->createMock (\AMQPConnection::class);
329
+ return $ this ->getMockBuilder (\AMQPConnection::class)
330
+ ->setMethods (['isPersistent ' , 'isConnected ' , 'pdisconnect ' , 'disconnect ' ])
331
+ ->getMock ()
332
+ ;
330
333
}
331
334
}
0 commit comments