@@ -61,16 +61,17 @@ public function testShouldHaveExpectedOptions()
61
61
62
62
$ options = $ command ->getDefinition ()->getOptions ();
63
63
64
- $ this ->assertCount (6 , $ options );
64
+ $ this ->assertCount (7 , $ options );
65
65
$ this ->assertArrayHasKey ('memory-limit ' , $ options );
66
66
$ this ->assertArrayHasKey ('message-limit ' , $ options );
67
67
$ this ->assertArrayHasKey ('time-limit ' , $ options );
68
68
$ this ->assertArrayHasKey ('setup-broker ' , $ options );
69
69
$ this ->assertArrayHasKey ('idle-timeout ' , $ options );
70
70
$ this ->assertArrayHasKey ('receive-timeout ' , $ options );
71
+ $ this ->assertArrayHasKey ('skip ' , $ options );
71
72
}
72
73
73
- public function testShouldHaveExpectedAttributes ()
74
+ public function testShouldHaveExpectedArguments ()
74
75
{
75
76
$ command = new ConsumeMessagesCommand (
76
77
$ this ->createQueueConsumerMock (),
@@ -171,6 +172,63 @@ public function testShouldExecuteConsumptionAndUseCustomClientDestinationName()
171
172
]);
172
173
}
173
174
175
+ public function testShouldSkipQueueConsumptionAndUseCustomClientDestinationName ()
176
+ {
177
+ $ queue = new NullQueue ('' );
178
+
179
+ $ processor = $ this ->createDelegateProcessorMock ();
180
+
181
+ $ context = $ this ->createPsrContextMock ();
182
+ $ context
183
+ ->expects ($ this ->never ())
184
+ ->method ('close ' )
185
+ ;
186
+
187
+ $ consumer = $ this ->createQueueConsumerMock ();
188
+ $ consumer
189
+ ->expects ($ this ->exactly (2 ))
190
+ ->method ('bind ' )
191
+ ;
192
+ $ consumer
193
+ ->expects ($ this ->once ())
194
+ ->method ('consume ' )
195
+ ->with ($ this ->isInstanceOf (ChainExtension::class))
196
+ ;
197
+
198
+ $ queueMetaRegistry = $ this ->createQueueMetaRegistry ([
199
+ 'fooQueue ' => [
200
+ 'transportName ' => 'fooTransportQueue ' ,
201
+ ],
202
+ 'barQueue ' => [
203
+ 'transportName ' => 'barTransportQueue ' ,
204
+ ],
205
+ 'ololoQueue ' => [
206
+ 'transportName ' => 'ololoTransportQueue ' ,
207
+ ],
208
+ ]);
209
+
210
+ $ driver = $ this ->createDriverMock ();
211
+ $ driver
212
+ ->expects ($ this ->at (0 ))
213
+ ->method ('createQueue ' )
214
+ ->with ('fooQueue ' )
215
+ ->willReturn ($ queue )
216
+ ;
217
+ $ driver
218
+ ->expects ($ this ->at (1 ))
219
+ ->method ('createQueue ' )
220
+ ->with ('ololoQueue ' )
221
+ ->willReturn ($ queue )
222
+ ;
223
+
224
+ $ command = new ConsumeMessagesCommand ($ consumer , $ processor , $ queueMetaRegistry , $ driver );
225
+
226
+ $ tester = new CommandTester ($ command );
227
+ $ tester ->execute ([
228
+ '--skip ' => ['barQueue ' ],
229
+ ]);
230
+ }
231
+
174
232
/**
175
233
* @param array $destinationNames
176
234
*
0 commit comments