@@ 15-45 (lines=31) @@ | ||
12 | /** |
|
13 | * @author Kevin Bond <[email protected]> |
|
14 | */ |
|
15 | class CheckCollectionTagCompilerPassTest extends AbstractCompilerPassTestCase |
|
16 | { |
|
17 | public function testProcess() |
|
18 | { |
|
19 | $defaultGroup = 'grupo_predeterminado'; |
|
20 | ||
21 | $runner = new Definition(); |
|
22 | $this->setDefinition('liip_monitor.runner', $runner); |
|
23 | $this->setParameter('liip_monitor.default_group', $defaultGroup); |
|
24 | ||
25 | $check = new Definition(); |
|
26 | $check->addTag('liip_monitor.check_collection'); |
|
27 | $this->setDefinition('example_check_collection', $check); |
|
28 | ||
29 | $this->compile(); |
|
30 | ||
31 | $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
|
32 | 'liip_monitor.runner_'.$defaultGroup, |
|
33 | 'addChecks', |
|
34 | [ |
|
35 | new Reference('example_check_collection'), |
|
36 | ] |
|
37 | ); |
|
38 | } |
|
39 | ||
40 | protected function registerCompilerPass(ContainerBuilder $container): void |
|
41 | { |
|
42 | $container->addCompilerPass(new GroupRunnersCompilerPass()); |
|
43 | $container->addCompilerPass(new CheckCollectionTagCompilerPass()); |
|
44 | } |
|
45 | } |
|
46 |
@@ 15-46 (lines=32) @@ | ||
12 | /** |
|
13 | * @author Kevin Bond <[email protected]> |
|
14 | */ |
|
15 | class CheckTagCompilerPassTest extends AbstractCompilerPassTestCase |
|
16 | { |
|
17 | public function testProcess() |
|
18 | { |
|
19 | $defaultGroup = 'gruppo_predefinito'; |
|
20 | ||
21 | $runner = new Definition(); |
|
22 | $this->setDefinition('liip_monitor.runner', $runner); |
|
23 | $this->setParameter('liip_monitor.default_group', $defaultGroup); |
|
24 | ||
25 | $check = new Definition(); |
|
26 | $check->addTag('liip_monitor.check'); |
|
27 | $this->setDefinition('example_check', $check); |
|
28 | ||
29 | $this->compile(); |
|
30 | ||
31 | $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
|
32 | 'liip_monitor.runner_'.$defaultGroup, |
|
33 | 'addCheck', |
|
34 | [ |
|
35 | new Reference('example_check'), |
|
36 | 'example_check', |
|
37 | ] |
|
38 | ); |
|
39 | } |
|
40 | ||
41 | protected function registerCompilerPass(ContainerBuilder $container): void |
|
42 | { |
|
43 | $container->addCompilerPass(new GroupRunnersCompilerPass()); |
|
44 | $container->addCompilerPass(new CheckTagCompilerPass()); |
|
45 | } |
|
46 | } |
|
47 |