Completed
Push — api ( cecea0...116a36 )
by Kamil
29:57 queued 30s
created

SyliusApiBundleExtension   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 29
c 0
b 0
f 0
wmc 5
lcom 0
cbo 3
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 3 1
A getConfigKey() 0 4 1
A initialize() 0 3 1
A configure() 0 3 1
A load() 0 9 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Sylius\Bundle\ApiBundle\Behat\Extension;
15
16
use Behat\Testwork\ServiceContainer\Extension;
17
use Behat\Testwork\ServiceContainer\ExtensionManager;
18
use Behat\Behat\Tester\ServiceContainer\TesterExtension;
19
use Sylius\Bundle\ApiBundle\Behat\Tester\ApiScenarioEventDispatchingScenarioTester;
20
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
21
use Symfony\Component\DependencyInjection\ContainerBuilder;
22
use Symfony\Component\DependencyInjection\Definition;
23
use Symfony\Component\DependencyInjection\Reference;
24
25
/**
26
 * This extension disables javascript session when running api scenarios
27
 */
28
final class SyliusApiBundleExtension implements Extension
29
{
30
    public function process(ContainerBuilder $container): void
31
    {
32
    }
33
34
    public function getConfigKey(): string
35
    {
36
        return 'sylius_api';
37
    }
38
39
    public function initialize(ExtensionManager $extensionManager): void
40
    {
41
    }
42
43
    public function configure(ArrayNodeDefinition $builder): void
44
    {
45
    }
46
47
    public function load(ContainerBuilder $container, array $config): void
48
    {
49
        $definition = new Definition(ApiScenarioEventDispatchingScenarioTester::class, [
50
            new Reference(TesterExtension::EXAMPLE_TESTER_ID)
51
        ]);
52
        $definition->addTag(TesterExtension::SCENARIO_TESTER_WRAPPER_TAG, array('priority' => -100000));
53
54
        $container->setDefinition(ApiScenarioEventDispatchingScenarioTester::class, $definition);
55
    }
56
}
57