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('SYMFONY_SERIALIZER')) { |
59
|
|
|
$loader->load(__DIR__ . '/config_symfony.yml'); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
if (false !== getenv('DOCTRINE_BUNDLE')) { |
63
|
|
|
$loader->load(__DIR__ . '/config_doctrine.yml'); |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function getName() |
68
|
|
|
{ |
69
|
|
|
$name = 'jsorpc_test'; |
70
|
|
|
|
71
|
|
|
if (false !== getenv('JMS_BUNDLE')) { |
72
|
|
|
$name .= '_jms'; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
if (false !== getenv('SYMFONY_SERIALIZER')) { |
76
|
|
|
$name .= '_symfony'; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
if (false !== getenv('DOCTRINE_BUNDLE')) { |
80
|
|
|
$name .= '_doctrine'; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
return $name; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function getEnvironment() |
87
|
|
|
{ |
88
|
|
|
return 'test'; |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|