| 1 | <?php |
||
| 14 | |||
| 15 | class HandlersLocatorFactoryTest extends TestCase |
||
| 16 | { |
||
| 17 | use ProphecyTrait; |
||
| 18 | |||
| 19 | public function testFactory(): void |
||
| 20 | { |
||
| 21 | $factory = new HandlersLocatorFactory('bus_name'); |
||
| 22 | |||
| 23 | $container = $this->prophesize(ContainerInterface::class); |
||
| 24 | $container->has('config')->willReturn(true); |
||
| 25 | $container->get('config')->willReturn([ |
||
| 26 | 'messenger' => [ |
||
| 27 | 'buses' => [ |
||
| 28 | 'bus_name' => [ |
||
| 29 | 'handlers' => [ |
||
| 30 | 'foo' => [ |
||
| 31 | 'handler1', |
||
| 32 | static function () {}, |
||
| 33 | new HandlerDescriptor(static function () {}), |
||
| 34 | ], |
||
| 35 | ], |
||
| 36 | ], |
||
| 37 | ], |
||
| 38 | ], |
||
| 39 | ]); |
||
| 40 | /** @var HandlersLocator $service */ |
||
| 41 | $service = $factory($container->reveal()); |
||
| 42 | |||
| 43 | $this->assertInstanceOf(HandlersLocatorInterface::class, $service); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |