-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathErrorExtension.php
More file actions
62 lines (51 loc) · 1.53 KB
/
ErrorExtension.php
File metadata and controls
62 lines (51 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
namespace RMiller\BehatSpec\Extension\ErrorExtension;
use Behat\Testwork\ServiceContainer\Extension as ExtensionInterface;
use Behat\Testwork\ServiceContainer\ExtensionManager;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
class ErrorExtension implements ExtensionInterface
{
/**
* {@inheritDoc}
*/
public function load(ContainerBuilder $container, array $config)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__));
$loader->load('services.xml');
}
/**
* {@inheritDoc}
*/
public function configure(ArrayNodeDefinition $builder)
{
}
/**
* {@inheritDoc}
*/
public function getConfigKey()
{
return 'error';
}
/**
* {@inheritdoc}
*/
public function initialize(ExtensionManager $extensionManager)
{
}
/**
* {@inheritDoc}
*/
public function process(ContainerBuilder $container)
{
$errorTesterDefinition = $container->getDefinition('rmiller.error_extension.error_tester');
$errorListeners = [];
foreach ($container->findTaggedServiceIds('rmiller.error_listener') as $id => $tags) {
$errorListeners[] = new Reference($id);
}
$errorTesterDefinition->replaceArgument(2, $errorListeners);
}
}