Test Failed
Push — feature/improve ( 3cba19 )
by Yo
03:30
created

Behat3SymfonyFactory::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
1
<?php
2
namespace Yoanm\Behat3SymfonyExtension\ServiceContainer\DriverFactory;
3
4
use Behat\Mink\Driver\BrowserKitDriver;
5
use Behat\MinkExtension\ServiceContainer\Driver\DriverFactory;
6
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
7
use Symfony\Component\DependencyInjection\Definition;
8
use Symfony\Component\DependencyInjection\Reference;
9
use Yoanm\Behat3SymfonyExtension\Driver\KernelDriver;
10
use Yoanm\Behat3SymfonyExtension\ServiceContainer\Behat3SymfonyExtension;
11
12
class Behat3SymfonyFactory implements DriverFactory
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function getDriverName()
18
    {
19
        return 'behat3Symfony';
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function supportsJavascript()
26
    {
27
        return false;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function configure(ArrayNodeDefinition $builder)
34
    {
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function buildDriver(array $config)
41
    {
42
        if (!class_exists('Behat\Mink\Driver\BrowserKitDriver')) {
43
            throw new \RuntimeException(
44
                'Install MinkBrowserKitDriver in order to use the behat3Symfony driver.'
45
            );
46
        }
47
48
        return new Definition(
49
            BrowserKitDriver::class,
50
            [
51
                new Reference(Behat3SymfonyExtension::TEST_CLIENT_SERVICE_ID),
52
                '%mink.base_url%',
53
            ]
54
        );
55
    }
56
}
57