Failed Conditions
Push — feature/extension ( 4da90f...371818 )
by Yo
02:21
created

Behat3SymfonyDriverFactory::getDriverName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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