1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Liip/FunctionalTestBundle |
7
|
|
|
* |
8
|
|
|
* (c) Lukas Kahwe Smith <[email protected]> |
9
|
|
|
* |
10
|
|
|
* This source file is subject to the MIT license that is bundled |
11
|
|
|
* with this source code in the file LICENSE. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Liip\FunctionalTestBundle\DependencyInjection; |
15
|
|
|
|
16
|
|
|
use Symfony\Component\Config\FileLocator; |
17
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
18
|
|
|
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; |
19
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
20
|
|
|
|
21
|
|
|
class LiipFunctionalTestExtension extends Extension |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* Loads the services based on your application configuration. |
25
|
|
|
*/ |
26
|
1 |
|
public function load(array $configs, ContainerBuilder $container): void |
27
|
|
|
{ |
28
|
1 |
|
$config = $this->processConfiguration(new Configuration(), $configs); |
29
|
|
|
|
30
|
1 |
|
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
31
|
1 |
|
$loader->load('functional_test.xml'); |
32
|
|
|
|
33
|
1 |
|
if (interface_exists('Symfony\Component\Validator\Validator\ValidatorInterface')) { |
34
|
1 |
|
$loader->load('validator.xml'); |
35
|
|
|
} |
36
|
|
|
|
37
|
1 |
|
foreach ($config as $key => $value) { |
38
|
|
|
// If the node is an array, |
39
|
|
|
// e.g. "liip_functional_test.query.max_query_count", |
40
|
|
|
// set the value as |
41
|
|
|
// "liip_functional_test.query.max_query_count" |
42
|
|
|
// instead of an array "liip_functional_test.query" |
43
|
|
|
// with a "max_query_count" key. |
44
|
1 |
|
if (\is_array($value)) { |
45
|
1 |
|
foreach ($value as $key2 => $value2) { |
46
|
1 |
|
$container->setParameter($this->getAlias().'.'.$key. |
47
|
1 |
|
'.'.$key2, $value2); |
48
|
|
|
} |
49
|
|
|
} else { |
50
|
1 |
|
$container->setParameter($this->getAlias().'.'.$key, $value); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|
54
|
1 |
|
$definition = $container->getDefinition('liip_functional_test.query.count_client'); |
55
|
1 |
|
$definition->setShared(false); |
56
|
1 |
|
} |
57
|
|
|
} |
58
|
|
|
|