Failed Conditions
Pull Request — master (#16)
by Yo
04:22 queued 02:13
created

Behat3SymfonyFactory::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\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 1
        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 1
        return new Definition(
49 1
            BrowserKitDriver::class,
50
            [
51 1
                new Reference(Behat3SymfonyExtension::TEST_CLIENT_SERVICE_ID),
52 1
                '%mink.base_url%',
53
            ]
54 1
        );
55
    }
56
}
57