| 1 | <?php |
||
| 14 | |||
| 15 | class DoctrineTransactionMiddlewareFactoryTest extends TestCase |
||
| 16 | { |
||
| 17 | use ProphecyTrait; |
||
| 18 | |||
| 19 | public function testFactory(): void |
||
| 20 | { |
||
| 21 | $container = $this->prophesize(ContainerInterface::class); |
||
| 22 | $managerRegistry = $this->prophesize(ManagerRegistry::class); |
||
| 23 | |||
| 24 | $container->get(ManagerRegistry::class) |
||
| 25 | ->shouldBeCalled() |
||
| 26 | ->willReturn($managerRegistry->reveal()); |
||
| 27 | |||
| 28 | $factory = [DoctrineTransactionMiddlewareFactory::class, 'connection_name']; |
||
| 29 | $service = $factory($container->reveal()); |
||
| 30 | |||
| 31 | $this->assertInstanceOf(DoctrineTransactionMiddleware::class, $service); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function testInvalidCall(): void |
||
| 35 | { |
||
| 36 | $this->expectException(InvalidArgumentException::class); |
||
| 37 | |||
| 38 | $factory = [DoctrineTransactionMiddlewareFactory::class, 'connection_name']; |
||
| 39 | $factory('foo'); |
||
| 42 |