Passed
Pull Request — master (#11)
by Pavel
07:52
created

TestKernel   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 10

Test Coverage

Coverage 94.87%

Importance

Changes 0
Metric Value
wmc 12
lcom 0
cbo 10
dl 0
loc 67
ccs 37
cts 39
cp 0.9487
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A registerBundles() 0 21 3
A getCacheDir() 0 4 1
A getLogDir() 0 4 1
A registerContainerConfiguration() 0 12 3
A getName() 0 14 3
A getEnvironment() 0 4 1
1
<?php
2
3
namespace Bankiru\Api\JsonRpc\Test\Kernel;
4
5
use Bankiru\Api\JsonRpc\BankiruJsonRpcServerBundle;
6
use Bankiru\Api\JsonRpc\Test\JsonRpcTestBundle;
7
use Bankiru\Api\Rpc\BankiruRpcServerBundle;
8
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
9
use JMS\SerializerBundle\JMSSerializerBundle;
10
use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle;
11
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
12
use Symfony\Bundle\SecurityBundle\SecurityBundle;
13
use Symfony\Component\Config\Loader\LoaderInterface;
14
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest;
15
16
final class TestKernel extends KernelForTest
17
{
18 15
    public function registerBundles()
19
    {
20
        $bundles = [
21 15
            new FrameworkBundle(),
22 15
            new SecurityBundle(),
23 15
            new SensioFrameworkExtraBundle(),
24 15
            new BankiruRpcServerBundle(),
25 15
            new BankiruJsonRpcServerBundle(),
26 15
            new JsonRpcTestBundle(),
27 15
        ];
28
29 15
        if (false !== getenv('JMS_BUNDLE')) {
30 15
            $bundles[] = new JMSSerializerBundle();
31 15
        }
32
33 15
        if (false !== getenv('DOCTRINE_BUNDLE')) {
34 15
            $bundles[] = new DoctrineBundle();
35 15
        }
36
37 15
        return $bundles;
38
    }
39
40 15
    public function getCacheDir()
41
    {
42 15
        return __DIR__ . '/../../build/' . $this->getName() . '/cache';
43
    }
44
45 1
    public function getLogDir()
46
    {
47 1
        return __DIR__ . '/../../build/' . $this->getName() . '/log';
48
    }
49
50 1
    public function registerContainerConfiguration(LoaderInterface $loader)
51
    {
52 1
        $loader->load(__DIR__ . '/config.yml');
53
54 1
        if (false !== getenv('JMS_BUNDLE')) {
55 1
            $loader->load(__DIR__ . '/config_jms.yml');
56 1
        }
57
58 1
        if (false !== getenv('DOCTRINE_BUNDLE')) {
59 1
            $loader->load(__DIR__ . '/config_doctrine.yml');
60 1
        }
61 1
    }
62
63 15
    public function getName()
64
    {
65 15
        $name = 'jsorpc_test';
66
67 15
        if (false !== getenv('JMS_BUNDLE')) {
68 15
            $name .= '_jms';
69 15
        }
70
71 15
        if (false !== getenv('DOCTRINE_BUNDLE')) {
72 15
            $name .= '_doctrine';
73 15
        }
74
75 15
        return $name;
76
    }
77
78
    public function getEnvironment()
79
    {
80
        return 'test';
81
    }
82
}
83