|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Symfony\Component\Filesystem\Filesystem; |
|
4
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
|
5
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Class AppKernel |
|
9
|
|
|
* |
|
10
|
|
|
* @package MewesK\TwigExcelBundle\Tests\Fixtures |
|
11
|
|
|
*/ |
|
12
|
|
|
class AppKernel extends Kernel |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* @var string |
|
16
|
|
|
*/ |
|
17
|
|
|
private $config; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @param string $config |
|
21
|
|
|
* @throws \RuntimeException |
|
22
|
|
|
*/ |
|
23
|
|
|
public function __construct($config) |
|
24
|
|
|
{ |
|
25
|
|
|
parent::__construct('test', true); |
|
26
|
|
|
|
|
27
|
|
|
$fs = new Filesystem(); |
|
28
|
|
|
if (!$fs->isAbsolutePath($config)) { |
|
29
|
|
|
$config = __DIR__ . '/config/' .$config; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
if (!file_exists($config)) { |
|
33
|
|
|
throw new \RuntimeException(sprintf('The config file "%s" does not exist.', $config)); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
$this->config = $config; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @return array |
|
41
|
|
|
*/ |
|
42
|
|
|
public function registerBundles() |
|
43
|
|
|
{ |
|
44
|
|
|
return [ |
|
45
|
|
|
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), |
|
46
|
|
|
new Symfony\Bundle\TwigBundle\TwigBundle(), |
|
47
|
|
|
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), |
|
48
|
|
|
new MewesK\TwigExcelBundle\MewesKTwigExcelBundle(), |
|
49
|
|
|
new MewesK\TwigExcelBundle\Tests\Fixtures\TestBundle\TestBundle() |
|
50
|
|
|
]; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @param LoaderInterface $loader |
|
55
|
|
|
* @throws \Exception |
|
56
|
|
|
*/ |
|
57
|
|
|
public function registerContainerConfiguration(LoaderInterface $loader) |
|
58
|
|
|
{ |
|
59
|
|
|
$loader->load($this->config); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @return string |
|
64
|
|
|
*/ |
|
65
|
|
|
public function getCacheDir() |
|
66
|
|
|
{ |
|
67
|
|
|
return __DIR__ . '/../../tmp/cache'; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @return string |
|
72
|
|
|
*/ |
|
73
|
|
|
public function getLogDir() |
|
74
|
|
|
{ |
|
75
|
|
|
return __DIR__ . '/../../tmp/logs'; |
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|