File tree 6 files changed +141
-0
lines changed
6 files changed +141
-0
lines changed Original file line number Diff line number Diff line change 5
5
use Bunny \Channel ;
6
6
use Bunny \Protocol \MethodQueueDeclareOkFrame ;
7
7
use Enqueue \AmqpBunny \AmqpContext ;
8
+ use Enqueue \AmqpBunny \AmqpSubscriptionConsumer ;
8
9
use Interop \Amqp \Impl \AmqpBind ;
9
10
use Interop \Amqp \Impl \AmqpQueue ;
10
11
use Interop \Amqp \Impl \AmqpTopic ;
12
+ use Interop \Queue \PsrSubscriptionConsumerAwareContext ;
11
13
use PHPUnit \Framework \TestCase ;
12
14
13
15
class AmqpContextTest extends TestCase
@@ -235,6 +237,20 @@ public function testShouldSetQos()
235
237
$ context ->setQos (123 , 456 , true );
236
238
}
237
239
240
+ public function testShouldImplementPsrSubscriptionConsumerAwareInterface ()
241
+ {
242
+ $ rc = new \ReflectionClass (AmqpContext::class);
243
+
244
+ $ this ->assertTrue ($ rc ->implementsInterface (PsrSubscriptionConsumerAwareContext::class));
245
+ }
246
+
247
+ public function testShouldReturnExpectedSubscriptionConsumerInstance ()
248
+ {
249
+ $ context = new AmqpContext ($ this ->createChannelMock ());
250
+
251
+ $ this ->assertInstanceOf (AmqpSubscriptionConsumer::class, $ context ->createSubscriptionConsumer ());
252
+ }
253
+
238
254
/**
239
255
* @return \PHPUnit_Framework_MockObject_MockObject|Channel
240
256
*/
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Enqueue \AmqpBunny \Tests ;
4
+
5
+ use Enqueue \AmqpBunny \AmqpContext ;
6
+ use Enqueue \AmqpBunny \AmqpSubscriptionConsumer ;
7
+ use Interop \Queue \PsrSubscriptionConsumer ;
8
+ use PHPUnit \Framework \TestCase ;
9
+
10
+ class AmqpSubscriptionConsumerTest extends TestCase
11
+ {
12
+ public function testShouldImplementPsrSubscriptionConsumerInterface ()
13
+ {
14
+ $ rc = new \ReflectionClass (AmqpSubscriptionConsumer::class);
15
+
16
+ $ this ->assertTrue ($ rc ->implementsInterface (PsrSubscriptionConsumer::class));
17
+ }
18
+
19
+ public function testCouldBeConstructedWithAmqpContextAsFirstArgument ()
20
+ {
21
+ new AmqpSubscriptionConsumer ($ this ->createAmqpContextMock ());
22
+ }
23
+
24
+ /**
25
+ * @return AmqpContext|\PHPUnit_Framework_MockObject_MockObject
26
+ */
27
+ private function createAmqpContextMock ()
28
+ {
29
+ return $ this ->createMock (AmqpContext::class);
30
+ }
31
+ }
Original file line number Diff line number Diff line change 5
5
use Enqueue \AmqpExt \AmqpConsumer ;
6
6
use Enqueue \AmqpExt \AmqpContext ;
7
7
use Enqueue \AmqpExt \AmqpProducer ;
8
+ use Enqueue \AmqpExt \AmqpSubscriptionConsumer ;
8
9
use Enqueue \AmqpExt \Buffer ;
9
10
use Enqueue \Null \NullQueue ;
10
11
use Enqueue \Null \NullTopic ;
14
15
use Interop \Amqp \Impl \AmqpTopic ;
15
16
use Interop \Queue \InvalidDestinationException ;
16
17
use Interop \Queue \PsrContext ;
18
+ use Interop \Queue \PsrSubscriptionConsumerAwareContext ;
17
19
use PHPUnit \Framework \TestCase ;
18
20
19
21
class AmqpContextTest extends TestCase
@@ -248,6 +250,20 @@ public function testShouldClosePersistedConnection()
248
250
$ context ->close ();
249
251
}
250
252
253
+ public function testShouldImplementPsrSubscriptionConsumerAwareInterface ()
254
+ {
255
+ $ rc = new \ReflectionClass (AmqpContext::class);
256
+
257
+ $ this ->assertTrue ($ rc ->implementsInterface (PsrSubscriptionConsumerAwareContext::class));
258
+ }
259
+
260
+ public function testShouldReturnExpectedSubscriptionConsumerInstance ()
261
+ {
262
+ $ context = new AmqpContext ($ this ->createExtChannelMock (), 'basic_get ' );
263
+
264
+ $ this ->assertInstanceOf (AmqpSubscriptionConsumer::class, $ context ->createSubscriptionConsumer ());
265
+ }
266
+
251
267
/**
252
268
* @return \PHPUnit_Framework_MockObject_MockObject|\AMQPChannel
253
269
*/
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Enqueue \AmqpExt \Tests ;
4
+
5
+ use Enqueue \AmqpExt \AmqpContext ;
6
+ use Enqueue \AmqpExt \AmqpSubscriptionConsumer ;
7
+ use Interop \Queue \PsrSubscriptionConsumer ;
8
+ use PHPUnit \Framework \TestCase ;
9
+
10
+ class AmqpSubscriptionConsumerTest extends TestCase
11
+ {
12
+ public function testShouldImplementPsrSubscriptionConsumerInterface ()
13
+ {
14
+ $ rc = new \ReflectionClass (AmqpSubscriptionConsumer::class);
15
+
16
+ $ this ->assertTrue ($ rc ->implementsInterface (PsrSubscriptionConsumer::class));
17
+ }
18
+
19
+ public function testCouldBeConstructedWithAmqpContextAsFirstArgument ()
20
+ {
21
+ new AmqpSubscriptionConsumer ($ this ->createAmqpContextMock ());
22
+ }
23
+
24
+ /**
25
+ * @return AmqpContext|\PHPUnit_Framework_MockObject_MockObject
26
+ */
27
+ private function createAmqpContextMock ()
28
+ {
29
+ return $ this ->createMock (AmqpContext::class);
30
+ }
31
+ }
Original file line number Diff line number Diff line change 3
3
namespace Enqueue \AmqpLib \Tests ;
4
4
5
5
use Enqueue \AmqpLib \AmqpContext ;
6
+ use Enqueue \AmqpLib \AmqpSubscriptionConsumer ;
6
7
use Interop \Amqp \Impl \AmqpBind ;
7
8
use Interop \Amqp \Impl \AmqpQueue ;
8
9
use Interop \Amqp \Impl \AmqpTopic ;
10
+ use Interop \Queue \PsrSubscriptionConsumerAwareContext ;
9
11
use PhpAmqpLib \Channel \AMQPChannel ;
10
12
use PhpAmqpLib \Connection \AbstractConnection ;
11
13
use PhpAmqpLib \Wire \AMQPTable ;
@@ -314,6 +316,20 @@ public function testShouldSetQos()
314
316
$ context ->setQos (123 , 456 , true );
315
317
}
316
318
319
+ public function testShouldImplementPsrSubscriptionConsumerAwareInterface ()
320
+ {
321
+ $ rc = new \ReflectionClass (AmqpContext::class);
322
+
323
+ $ this ->assertTrue ($ rc ->implementsInterface (PsrSubscriptionConsumerAwareContext::class));
324
+ }
325
+
326
+ public function testShouldReturnExpectedSubscriptionConsumerInstance ()
327
+ {
328
+ $ context = new AmqpContext ($ this ->createConnectionMock ());
329
+
330
+ $ this ->assertInstanceOf (AmqpSubscriptionConsumer::class, $ context ->createSubscriptionConsumer ());
331
+ }
332
+
317
333
/**
318
334
* @return \PHPUnit_Framework_MockObject_MockObject|AbstractConnection
319
335
*/
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Enqueue \AmqpLib \Tests ;
4
+
5
+ use Enqueue \AmqpLib \AmqpContext ;
6
+ use Enqueue \AmqpLib \AmqpSubscriptionConsumer ;
7
+ use Interop \Queue \PsrSubscriptionConsumer ;
8
+ use PHPUnit \Framework \TestCase ;
9
+
10
+ class AmqpSubscriptionConsumerTest extends TestCase
11
+ {
12
+ public function testShouldImplementPsrSubscriptionConsumerInterface ()
13
+ {
14
+ $ rc = new \ReflectionClass (AmqpSubscriptionConsumer::class);
15
+
16
+ $ this ->assertTrue ($ rc ->implementsInterface (PsrSubscriptionConsumer::class));
17
+ }
18
+
19
+ public function testCouldBeConstructedWithAmqpContextAsFirstArgument ()
20
+ {
21
+ new AmqpSubscriptionConsumer ($ this ->createAmqpContextMock ());
22
+ }
23
+
24
+ /**
25
+ * @return AmqpContext|\PHPUnit_Framework_MockObject_MockObject
26
+ */
27
+ private function createAmqpContextMock ()
28
+ {
29
+ return $ this ->createMock (AmqpContext::class);
30
+ }
31
+ }
You can’t perform that action at this time.
0 commit comments