|
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
|
|
|
|