1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AndreyOrs\BehatBootstrap; |
4
|
|
|
|
5
|
|
|
use Behat\Testwork\ServiceContainer\Extension; |
6
|
|
|
use Behat\Testwork\ServiceContainer\ExtensionManager; |
7
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
8
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
9
|
|
|
|
10
|
|
|
class Loader implements Extension |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @var BootstrapService |
14
|
|
|
*/ |
15
|
|
|
private $service; |
16
|
|
|
|
17
|
1 |
|
public function __construct() |
18
|
|
|
{ |
19
|
1 |
|
$this->service = new BootstrapService(); |
20
|
1 |
|
} |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @param ContainerBuilder $container |
24
|
|
|
* @param array $params |
25
|
|
|
* |
26
|
|
|
* @codeCoverageIgnore |
27
|
|
|
*/ |
28
|
|
|
public function load( |
29
|
|
|
ContainerBuilder $container, |
30
|
|
|
array $params |
31
|
|
|
) { |
32
|
|
|
$this->service->load($params); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Setups configuration for the extension. |
37
|
|
|
* |
38
|
|
|
* @param ArrayNodeDefinition $definition |
39
|
|
|
* |
40
|
|
|
* @codeCoverageIgnore |
41
|
|
|
*/ |
42
|
|
|
public function configure(ArrayNodeDefinition $definition) |
43
|
|
|
{ |
44
|
|
|
$this->service->configure($definition); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Returns the extension config key. |
49
|
|
|
* |
50
|
|
|
* @return string |
51
|
|
|
*/ |
52
|
1 |
|
public function getConfigKey() |
53
|
|
|
{ |
54
|
1 |
|
return BootstrapService::CONFIGURATION_KEY; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* You can modify the container here before it is dumped to PHP code. |
59
|
|
|
* |
60
|
|
|
* @param ContainerBuilder $container |
61
|
|
|
* |
62
|
|
|
* @codeCoverageIgnore |
63
|
|
|
*/ |
64
|
|
|
public function process(ContainerBuilder $container) |
65
|
|
|
{ |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Initializes other extensions. |
70
|
|
|
* This method is called immediately after all extensions are activated but |
71
|
|
|
* before any extension `configure()` method is called. This allows extensions |
72
|
|
|
* to hook into the configuration of other extensions providing such an |
73
|
|
|
* extension point. |
74
|
|
|
* |
75
|
|
|
* @param ExtensionManager $extensionManager |
76
|
|
|
* |
77
|
|
|
* @codeCoverageIgnore |
78
|
|
|
*/ |
79
|
|
|
public function initialize(ExtensionManager $extensionManager) |
80
|
|
|
{ |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|