Test Failed
Pull Request — master (#11)
by Pavel
11:44
created

TestKernel   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 10

Importance

Changes 0
Metric Value
wmc 12
lcom 0
cbo 10
dl 0
loc 67
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
    public function registerBundles()
19
    {
20
        $bundles = [
21
            new FrameworkBundle(),
22
            new SecurityBundle(),
23
            new SensioFrameworkExtraBundle(),
24
            new BankiruRpcServerBundle(),
25
            new BankiruJsonRpcServerBundle(),
26
            new JsonRpcTestBundle(),
27
        ];
28
29
        if (false !== getenv('JMS_BUNDLE')) {
30
            $bundles[] = new JMSSerializerBundle();
31
        }
32
33
        if (false !== getenv('DOCTRINE_BUNDLE')) {
34
            $bundles[] = new DoctrineBundle();
35
        }
36
37
        return $bundles;
38
    }
39
40
    public function getCacheDir()
41
    {
42
        return __DIR__ . '/../../build/' . $this->getName() . '/cache';
43
    }
44
45
    public function getLogDir()
46
    {
47
        return __DIR__ . '/../../build/' . $this->getName() . '/log';
48
    }
49
50
    public function registerContainerConfiguration(LoaderInterface $loader)
51
    {
52
        $loader->load(__DIR__ . '/config.yml');
53
54
        if (false !== getenv('JMS_BUNDLE')) {
55
            $loader->load(__DIR__ . '/config_jms.yml');
56
        }
57
58
        if (false !== getenv('DOCTRINE_BUNDLE')) {
59
            $loader->load(__DIR__ . '/config_doctrine.yml');
60
        }
61
    }
62
63
    public function getName()
64
    {
65
        $name = 'jsorpc_test';
66
67
        if (false !== getenv('JMS_BUNDLE')) {
68
            $name .= '_jms';
69
        }
70
71
        if (false !== getenv('DOCTRINE_BUNDLE')) {
72
            $name .= '_doctrine';
73
        }
74
75
        return $name;
76
    }
77
78
    public function getEnvironment()
79
    {
80
        return 'test';
81
    }
82
}
83