Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
22 | 5 | public function process(ContainerBuilder $container): void |
|
23 | { |
||
24 | 5 | if (null === $container->getParameter('liip_functional_test.query.max_query_count')) { |
|
25 | 3 | $container->removeDefinition('liip_functional_test.query.count_client'); |
|
26 | |||
27 | 3 | return; |
|
28 | } |
||
29 | |||
30 | 2 | 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 | 1 | $definition = $container->getDefinition('test.client'); |
|
34 | 1 | $definition->setPublic(false); |
|
35 | 1 | $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 | 1 | $container->setAlias('test.client', new Alias('liip_functional_test.query.count_client', true)); |
|
41 | 1 | } |
|
42 | } |
||
43 |