| Conditions | 1 |
| Paths | 1 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function testExtension() |
||
| 16 | { |
||
| 17 | $tempDir = __DIR__ . '/../temp/DI'; |
||
| 18 | Helpers::initTempDir($tempDir); |
||
| 19 | |||
| 20 | $container = (new Configurator()) |
||
| 21 | ->setTempDirectory($tempDir) |
||
| 22 | ->setDebugMode(true) |
||
| 23 | ->addConfig(__DIR__ . '/../config/config.neon') |
||
| 24 | ->createContainer(); |
||
| 25 | $container->initialize(); |
||
| 26 | |||
| 27 | /** @var Service1 $service1 */ |
||
| 28 | $service1 = $container->getByType(Service1::class); |
||
| 29 | self::assertInstanceOf(ProxyInterface::class, $service1); |
||
| 30 | self::assertEquals('bar', $service1->foo()); |
||
| 31 | |||
| 32 | /** @var IService2Factory $service2Factory */ |
||
| 33 | $service2Factory = $container->getByType(IService2Factory::class); |
||
| 34 | self::assertInstanceOf(ProxyInterface::class, $service2Factory); |
||
| 35 | self::assertInstanceOf(Service2::class, $service2Factory->create()); |
||
| 36 | } |
||
| 37 | } |
||
| 38 |