Completed
Push — master ( e5e74e...13adb5 )
by Yo
02:16
created

Behat3SymfonyFactory   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 48
ccs 12
cts 12
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getDriverName() 0 4 1
A supportsJavascript() 0 4 1
A configure() 0 3 1
A buildDriver() 0 19 2
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 1
    public function getDriverName()
18
    {
19 1
        return 'behat3Symfony';
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25 1
    public function supportsJavascript()
26
    {
27 1
        return false;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33 1
    public function configure(ArrayNodeDefinition $builder)
34
    {
35 1
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40 1
    public function buildDriver(array $config)
41
    {
42
        // @codeCoverageIgnoreStart
43
        // Not possible to test
44
        if (!class_exists('Behat\Mink\Driver\BrowserKitDriver')) {
45
            throw new \RuntimeException(
46
                'Install MinkBrowserKitDriver in order to use the behat3Symfony driver.'
47
            );
48
        }
49
        // @codeCoverageIgnoreEnd
50
51 1
        return new Definition(
52 1
            BrowserKitDriver::class,
53
            [
54 1
                new Reference(Behat3SymfonyExtension::TEST_CLIENT_SERVICE_ID),
55 1
                '%mink.base_url%',
56
            ]
57 1
        );
58
    }
59
}
60