33namespace Enqueue \Stomp \Tests ;
44
55use Enqueue \Stomp \BufferedStompClient ;
6+ use Enqueue \Stomp \ExtensionType ;
67use Enqueue \Stomp \StompConsumer ;
78use Enqueue \Stomp \StompContext ;
89use Enqueue \Stomp \StompDestination ;
@@ -24,27 +25,27 @@ public function testShouldImplementSessionInterface()
2425
2526 public function testCouldBeCreatedWithRequiredArguments ()
2627 {
27- new StompContext ($ this ->createStompClientMock ());
28+ new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
2829 }
2930
3031 public function testCouldBeConstructedWithExtChannelCallbackFactoryAsFirstArgument ()
3132 {
3233 new StompContext (function () {
3334 return $ this ->createStompClientMock ();
34- });
35+ }, ExtensionType:: RABBITMQ );
3536 }
3637
3738 public function testThrowIfNeitherCallbackNorExtChannelAsFirstArgument ()
3839 {
3940 $ this ->expectException (\InvalidArgumentException::class);
4041 $ this ->expectExceptionMessage ('The stomp argument must be either BufferedStompClient or callable that return BufferedStompClient. ' );
4142
42- new StompContext (new \stdClass ());
43+ new StompContext (new \stdClass (), ExtensionType:: RABBITMQ );
4344 }
4445
4546 public function testShouldCreateMessageInstance ()
4647 {
47- $ context = new StompContext ($ this ->createStompClientMock ());
48+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
4849
4950 $ message = $ context ->createMessage ('the body ' , ['key ' => 'value ' ], ['hkey ' => 'hvalue ' ]);
5051
@@ -56,7 +57,7 @@ public function testShouldCreateMessageInstance()
5657
5758 public function testShouldCreateQueueInstance ()
5859 {
59- $ context = new StompContext ($ this ->createStompClientMock ());
60+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
6061
6162 $ queue = $ context ->createQueue ('the name ' );
6263
@@ -68,7 +69,7 @@ public function testShouldCreateQueueInstance()
6869
6970 public function testCreateQueueShouldCreateDestinationIfNameIsFullDestinationString ()
7071 {
71- $ context = new StompContext ($ this ->createStompClientMock ());
72+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
7273
7374 $ destination = $ context ->createQueue ('/amq/queue/name/routing-key ' );
7475
@@ -81,7 +82,7 @@ public function testCreateQueueShouldCreateDestinationIfNameIsFullDestinationStr
8182
8283 public function testShouldCreateTopicInstanceWithExchangePrefix ()
8384 {
84- $ context = new StompContext ($ this ->createStompClientMock ());
85+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
8586
8687 $ topic = $ context ->createTopic ('the name ' );
8788
@@ -93,7 +94,7 @@ public function testShouldCreateTopicInstanceWithExchangePrefix()
9394
9495 public function testShouldCreateTopicInstanceWithTopicPrefix ()
9596 {
96- $ context = new StompContext ($ this ->createStompClientMock (), false );
97+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
9798
9899 $ topic = $ context ->createTopic ('the name ' );
99100
@@ -105,7 +106,7 @@ public function testShouldCreateTopicInstanceWithTopicPrefix()
105106
106107 public function testCreateTopicShouldCreateDestinationIfNameIsFullDestinationString ()
107108 {
108- $ context = new StompContext ($ this ->createStompClientMock ());
109+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
109110
110111 $ destination = $ context ->createTopic ('/amq/queue/name/routing-key ' );
111112
@@ -121,20 +122,20 @@ public function testThrowInvalidDestinationException()
121122 $ this ->expectException (InvalidDestinationException::class);
122123 $ this ->expectExceptionMessage ('The destination must be an instance of ' );
123124
124- $ session = new StompContext ($ this ->createStompClientMock ());
125+ $ session = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
125126 $ session ->createConsumer ($ this ->createMock (Queue::class));
126127 }
127128
128129 public function testShouldCreateMessageConsumerInstance ()
129130 {
130- $ context = new StompContext ($ this ->createStompClientMock ());
131+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
131132
132133 $ this ->assertInstanceOf (StompConsumer::class, $ context ->createConsumer ($ this ->createDummyDestination ()));
133134 }
134135
135136 public function testShouldCreateMessageProducerInstance ()
136137 {
137- $ context = new StompContext ($ this ->createStompClientMock ());
138+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
138139
139140 $ this ->assertInstanceOf (StompProducer::class, $ context ->createProducer ());
140141 }
@@ -147,7 +148,7 @@ public function testShouldCloseConnections()
147148 ->method ('disconnect ' )
148149 ;
149150
150- $ context = new StompContext ($ client );
151+ $ context = new StompContext ($ client, ExtensionType:: RABBITMQ );
151152
152153 $ context ->createProducer ();
153154 $ context ->createConsumer ($ this ->createDummyDestination ());
@@ -160,7 +161,7 @@ public function testCreateDestinationShouldThrowLogicExceptionIfTypeIsInvalid()
160161 $ this ->expectException (\LogicException::class);
161162 $ this ->expectExceptionMessage ('Destination name is invalid, cant find type: "/invalid-type/name" ' );
162163
163- $ context = new StompContext ($ this ->createStompClientMock ());
164+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
164165 $ context ->createDestination ('/invalid-type/name ' );
165166 }
166167
@@ -169,7 +170,7 @@ public function testCreateDestinationShouldThrowLogicExceptionIfExtraSlashFound(
169170 $ this ->expectException (\LogicException::class);
170171 $ this ->expectExceptionMessage ('Destination name is invalid, found extra / char: "/queue/name/routing-key/extra ' );
171172
172- $ context = new StompContext ($ this ->createStompClientMock ());
173+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
173174 $ context ->createDestination ('/queue/name/routing-key/extra ' );
174175 }
175176
@@ -178,7 +179,7 @@ public function testCreateDestinationShouldThrowLogicExceptionIfNameIsEmpty()
178179 $ this ->expectException (\LogicException::class);
179180 $ this ->expectExceptionMessage ('Destination name is invalid, name is empty: "/queue/" ' );
180181
181- $ context = new StompContext ($ this ->createStompClientMock ());
182+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
182183 $ context ->createDestination ('/queue/ ' );
183184 }
184185
@@ -187,13 +188,13 @@ public function testCreateDestinationShouldThrowLogicExceptionIfRoutingKeyIsEmpt
187188 $ this ->expectException (\LogicException::class);
188189 $ this ->expectExceptionMessage ('Destination name is invalid, routing key is empty: "/queue/name/" ' );
189190
190- $ context = new StompContext ($ this ->createStompClientMock ());
191+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
191192 $ context ->createDestination ('/queue/name/ ' );
192193 }
193194
194195 public function testCreateDestinationShouldParseStringAndCreateDestination ()
195196 {
196- $ context = new StompContext ($ this ->createStompClientMock ());
197+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
197198 $ destination = $ context ->createDestination ('/amq/queue/name/routing-key ' );
198199
199200 $ this ->assertEquals ('amq/queue ' , $ destination ->getType ());
@@ -204,7 +205,7 @@ public function testCreateDestinationShouldParseStringAndCreateDestination()
204205
205206 public function testCreateTemporaryQueue ()
206207 {
207- $ context = new StompContext ($ this ->createStompClientMock ());
208+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
208209 $ tempQueue = $ context ->createTemporaryQueue ();
209210
210211 $ this ->assertEquals ('temp-queue ' , $ tempQueue ->getType ());
@@ -215,7 +216,7 @@ public function testCreateTemporaryQueue()
215216
216217 public function testCreateTemporaryQueuesWithUniqueNames ()
217218 {
218- $ context = new StompContext ($ this ->createStompClientMock ());
219+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
219220 $ fooTempQueue = $ context ->createTemporaryQueue ();
220221 $ barTempQueue = $ context ->createTemporaryQueue ();
221222
@@ -227,7 +228,7 @@ public function testCreateTemporaryQueuesWithUniqueNames()
227228
228229 public function testShouldGetBufferedStompClient ()
229230 {
230- $ context = new StompContext ($ this ->createStompClientMock ());
231+ $ context = new StompContext ($ this ->createStompClientMock (), ExtensionType:: RABBITMQ );
231232
232233 $ this ->assertInstanceOf (BufferedStompClient::class, $ context ->getStomp ());
233234 }
@@ -242,7 +243,7 @@ private function createStompClientMock()
242243
243244 private function createDummyDestination (): StompDestination
244245 {
245- $ destination = new StompDestination ();
246+ $ destination = new StompDestination (ExtensionType:: RABBITMQ );
246247 $ destination ->setStompName ('aName ' );
247248 $ destination ->setType (StompDestination::TYPE_QUEUE );
248249
0 commit comments