| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3.576 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | 2 | public function process(ContainerBuilder $container): void |
|
| 23 | { |
||
| 24 | 2 | if (null === $container->getParameter('liip_functional_test.query.max_query_count')) { |
|
| 25 | 1 | $container->removeDefinition('liip_functional_test.query.count_client'); |
|
| 26 | |||
| 27 | 1 | return; |
|
| 28 | } |
||
| 29 | |||
| 30 | 1 | if ($container->hasDefinition('test.client')) { |
|
| 31 | // test.client is a definition. |
||
| 32 | // Register it again as a private service to inject it as the parent |
||
| 33 | $definition = $container->getDefinition('test.client'); |
||
| 34 | $definition->setPublic(false); |
||
| 35 | $container->setDefinition('liip_functional_test.query.count_client.parent', $definition); |
||
| 36 | } else { |
||
| 37 | 1 | throw new \Exception('The LiipFunctionalTestBundle\'s Query Counter can only be used in the test environment.'.\PHP_EOL.'See https://github.com/liip/LiipFunctionalTestBundle#only-in-test-environment'); |
|
| 38 | } |
||
| 39 | |||
| 40 | $container->setAlias('test.client', new Alias('liip_functional_test.query.count_client', true)); |
||
| 41 | } |
||
| 43 |