| 1 | <?php |
||
| 13 | |||
| 14 | class RetryStrategyLocatorFactoryTest extends TestCase |
||
| 15 | { |
||
| 16 | use ProphecyTrait; |
||
| 17 | |||
| 18 | public function testFactory(): void |
||
| 19 | { |
||
| 20 | $container = $this->prophesize(ContainerInterface::class); |
||
| 21 | $container->has('config')->willReturn(true); |
||
| 22 | $container->get('config')->willReturn([ |
||
| 23 | 'messenger' => [ |
||
| 24 | 'transports' => [ |
||
| 25 | 'foo' => [ |
||
| 26 | 'retry_strategy' => 'foo_strategy', |
||
| 27 | ], |
||
| 28 | ], |
||
| 29 | ], |
||
| 30 | ]); |
||
| 31 | |||
| 32 | $strategy = $this->prophesize(RetryStrategyInterface::class); |
||
| 33 | $container->get('foo_strategy') |
||
| 34 | ->shouldBeCalled() |
||
| 35 | ->willReturn($strategy->reveal()); |
||
| 36 | |||
| 37 | $factory = new RetryStrategyLocatorFactory(); |
||
| 38 | $service = $factory($container->reveal()); |
||
| 39 | |||
| 40 | $this->assertInstanceOf(ServiceManager::class, $service); |
||
| 41 | |||
| 42 | $this->assertSame($strategy->reveal(), $service->get('foo')); |
||
| 45 |