|
17 | 17 | use FiveLab\Component\Amqp\Consumer\Checker\ContainerRunConsumerCheckerRegistry; |
18 | 18 | use FiveLab\Component\Amqp\Consumer\Registry\ContainerConsumerRegistry; |
19 | 19 | use PHPUnit\Framework\Attributes\Test; |
| 20 | +use Symfony\Component\DependencyInjection\ContainerInterface; |
20 | 21 | use Symfony\Component\DependencyInjection\Reference; |
21 | 22 |
|
22 | 23 | class AmqpExtensionConfigureConsumersTest extends AmqpExtensionTestCase |
@@ -75,12 +76,21 @@ public function shouldSuccessConfigureSingleConsumer(): void |
75 | 76 | ]); |
76 | 77 |
|
77 | 78 | // Verify consumer |
78 | | - $this->assertService('fivelab.amqp.consumer.foo', '@fivelab.amqp.consumer_single.abstract', [ |
79 | | - new Reference('fivelab.amqp.queue_factory.default'), |
80 | | - new Reference('fivelab.amqp.consumer.foo.message_handler'), |
81 | | - new Reference('fivelab.amqp.consumer.foo.configuration'), |
82 | | - new Reference('fivelab.amqp.consumer.foo.strategy'), |
83 | | - ]); |
| 79 | + $this->assertService( |
| 80 | + 'fivelab.amqp.consumer.foo', |
| 81 | + '@fivelab.amqp.consumer_single.abstract', |
| 82 | + [ |
| 83 | + new Reference('fivelab.amqp.queue_factory.default'), |
| 84 | + new Reference('fivelab.amqp.consumer.foo.message_handler'), |
| 85 | + new Reference('fivelab.amqp.consumer.foo.configuration'), |
| 86 | + new Reference('fivelab.amqp.consumer.foo.strategy'), |
| 87 | + ], |
| 88 | + calls: [ |
| 89 | + 'setEventDispatcher' => [ |
| 90 | + [new Reference('event_dispatcher', ContainerInterface::NULL_ON_INVALID_REFERENCE)], |
| 91 | + ], |
| 92 | + ] |
| 93 | + ); |
84 | 94 |
|
85 | 95 | // Verify message handler |
86 | 96 | $this->assertService('fivelab.amqp.consumer.foo.message_handler', '@fivelab.amqp.consumer.message_handler.abstract', [ |
@@ -247,12 +257,21 @@ public function shouldSuccessConfigureSpoolConsumer(): void |
247 | 257 | $this->assertContainerBuilderHasService('fivelab.amqp.consumer.bar.configuration'); |
248 | 258 |
|
249 | 259 | // Verify consumer |
250 | | - $this->assertService('fivelab.amqp.consumer.bar', '@fivelab.amqp.consumer_spool.abstract', [ |
251 | | - new Reference('fivelab.amqp.queue_factory.default'), |
252 | | - new Reference('fivelab.amqp.consumer.bar.message_handler'), |
253 | | - new Reference('fivelab.amqp.consumer.bar.configuration'), |
254 | | - new Reference('fivelab.amqp.consumer.bar.strategy'), |
255 | | - ]); |
| 260 | + $this->assertService( |
| 261 | + 'fivelab.amqp.consumer.bar', |
| 262 | + '@fivelab.amqp.consumer_spool.abstract', |
| 263 | + [ |
| 264 | + new Reference('fivelab.amqp.queue_factory.default'), |
| 265 | + new Reference('fivelab.amqp.consumer.bar.message_handler'), |
| 266 | + new Reference('fivelab.amqp.consumer.bar.configuration'), |
| 267 | + new Reference('fivelab.amqp.consumer.bar.strategy'), |
| 268 | + ], |
| 269 | + calls: [ |
| 270 | + 'setEventDispatcher' => [ |
| 271 | + [new Reference('event_dispatcher', ContainerInterface::NULL_ON_INVALID_REFERENCE)], |
| 272 | + ], |
| 273 | + ] |
| 274 | + ); |
256 | 275 |
|
257 | 276 | // Verify configuration |
258 | 277 | $this->assertService('fivelab.amqp.consumer.bar.configuration', '@fivelab.amqp.consumer_spool.configuration.abstract', [ |
@@ -306,12 +325,21 @@ public function shouldSuccessConfigureLoopConsumer(): void |
306 | 325 | ]); |
307 | 326 |
|
308 | 327 | // Verify consumer |
309 | | - $this->assertService('fivelab.amqp.consumer.bar', '@fivelab.amqp.consumer_loop.abstract', [ |
310 | | - new Reference('fivelab.amqp.queue_factory.default'), |
311 | | - new Reference('fivelab.amqp.consumer.bar.message_handler'), |
312 | | - new Reference('fivelab.amqp.consumer.bar.configuration'), |
313 | | - new Reference('fivelab.amqp.consumer.bar.strategy'), |
314 | | - ]); |
| 328 | + $this->assertService( |
| 329 | + 'fivelab.amqp.consumer.bar', |
| 330 | + '@fivelab.amqp.consumer_loop.abstract', |
| 331 | + [ |
| 332 | + new Reference('fivelab.amqp.queue_factory.default'), |
| 333 | + new Reference('fivelab.amqp.consumer.bar.message_handler'), |
| 334 | + new Reference('fivelab.amqp.consumer.bar.configuration'), |
| 335 | + new Reference('fivelab.amqp.consumer.bar.strategy'), |
| 336 | + ], |
| 337 | + calls: [ |
| 338 | + 'setEventDispatcher' => [ |
| 339 | + [new Reference('event_dispatcher', ContainerInterface::NULL_ON_INVALID_REFERENCE)], |
| 340 | + ], |
| 341 | + ] |
| 342 | + ); |
315 | 343 |
|
316 | 344 | // Verify configuration |
317 | 345 | $this->assertService('fivelab.amqp.consumer.bar.configuration', '@fivelab.amqp.consumer_loop.configuration.abstract', [ |
|
0 commit comments