1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ScayTrase\Api\Cruds\Tests\Fixtures\Common; |
4
|
|
|
|
5
|
|
|
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; |
6
|
|
|
use ScayTrase\Api\Cruds\CrudsBundle; |
7
|
|
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; |
8
|
|
|
use Symfony\Component\Config\ConfigCache; |
9
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
10
|
|
|
use Symfony\Component\Config\Resource\FileResource; |
11
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
12
|
|
|
|
13
|
|
|
abstract class CrudsTestKernel extends Kernel |
14
|
|
|
{ |
15
|
|
|
/** {@inheritdoc} */ |
16
|
|
|
public function registerBundles() |
17
|
|
|
{ |
18
|
|
|
return [ |
19
|
|
|
new CrudsBundle(), |
20
|
|
|
new DoctrineBundle(), |
21
|
|
|
new MyBundle(), |
22
|
|
|
new FrameworkBundle(), |
23
|
|
|
]; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function getCacheDir() |
27
|
|
|
{ |
28
|
|
|
return __DIR__ . '/../../../build/' . $this->getClassName() . '/cache'; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function getLogDir() |
32
|
|
|
{ |
33
|
|
|
return __DIR__ . '/../../../build/' . $this->getClassName() . '/logs'; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** {@inheritdoc} */ |
37
|
|
|
public function registerContainerConfiguration(LoaderInterface $loader) |
38
|
|
|
{ |
39
|
|
|
return $loader->load(__DIR__ . '/config.yml'); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** {@inheritdoc} */ |
43
|
|
|
protected function buildContainer() |
44
|
|
|
{ |
45
|
|
|
$container = parent::buildContainer(); |
46
|
|
|
$container->addResource(new FileResource(__DIR__ . '/config.yml')); |
47
|
|
|
$container->addResource(new FileResource(__DIR__ . '/routing.yml')); |
48
|
|
|
|
49
|
|
|
return $container; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return array |
54
|
|
|
*/ |
55
|
|
|
private function getClassName() |
56
|
|
|
{ |
57
|
|
|
$path = explode('\\', static::class); |
58
|
|
|
|
59
|
|
|
return array_pop($path); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
protected function initializeContainer() |
63
|
|
|
{ |
64
|
|
|
$class = $this->getContainerClass(); |
65
|
|
|
$cache = new ConfigCache($this->getCacheDir().'/'.$class.'.php', $this->debug); |
66
|
|
|
|
67
|
|
|
$container = $this->buildContainer(); |
68
|
|
|
$container->compile(); |
69
|
|
|
$this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass()); |
70
|
|
|
|
71
|
|
|
parent::initializeContainer(); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|