@@ -179,6 +179,53 @@ public function testProducerSendsMessage(array $enqueueConfig)
179179 $ this ->assertSame ('test message body ' , $ message ->getBody ());
180180 }
181181
182+ /**
183+ * @dataProvider provideEnqueueConfigs
184+ */
185+ public function testProducerSendsCommandMessage (array $ enqueueConfig )
186+ {
187+ $ this ->customSetUp ($ enqueueConfig );
188+
189+ $ expectedBody = __METHOD__ .time ();
190+
191+ $ this ->getMessageProducer ()->sendCommand (TestCommandProcessor::COMMAND , $ expectedBody );
192+
193+ $ queue = $ this ->getPsrContext ()->createQueue ('enqueue.test ' );
194+
195+ $ consumer = $ this ->getPsrContext ()->createConsumer ($ queue );
196+
197+ $ message = $ consumer ->receive (100 );
198+ $ consumer ->acknowledge ($ message );
199+
200+ $ this ->assertInstanceOf (PsrMessage::class, $ message );
201+ $ this ->assertSame ($ expectedBody , $ message ->getBody ());
202+ }
203+
204+ /**
205+ * @dataProvider provideEnqueueConfigs
206+ */
207+ public function testClientConsumeCommandMessagesFromExplicitlySetQueue (array $ enqueueConfig )
208+ {
209+ $ this ->customSetUp ($ enqueueConfig );
210+
211+ $ command = $ this ->container ->get ('enqueue.client.consume_messages_command ' );
212+ $ processor = $ this ->container ->get ('test.message.command_processor ' );
213+
214+ $ expectedBody = __METHOD__ .time ();
215+
216+ $ this ->getMessageProducer ()->sendCommand (TestCommandProcessor::COMMAND , $ expectedBody );
217+
218+ $ tester = new CommandTester ($ command );
219+ $ tester ->execute ([
220+ '--message-limit ' => 2 ,
221+ '--time-limit ' => 'now +10 seconds ' ,
222+ 'client-queue-names ' => ['test ' ],
223+ ]);
224+
225+ $ this ->assertInstanceOf (PsrMessage::class, $ processor ->message );
226+ $ this ->assertEquals ($ expectedBody , $ processor ->message ->getBody ());
227+ }
228+
182229 /**
183230 * @dataProvider provideEnqueueConfigs
184231 */
0 commit comments