-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathAppKernel.php
66 lines (52 loc) · 1.49 KB
/
AppKernel.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/*
* This file is part of php-cache\cache-bundle package.
*
* (c) 2015-2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Cache\CacheBundle\Tests\Functional\app;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
{
private $config;
public function __construct($config)
{
parent::__construct('test', true);
$fs = new Filesystem();
if (!$fs->isAbsolutePath($config)) {
$config = __DIR__.'/config/'.$config;
}
if (!file_exists($config)) {
throw new \RuntimeException(sprintf('The config file "%s" does not exist', $config));
}
$this->config = $config;
}
public function registerBundles()
{
return [
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new \Cache\CacheBundle\CacheBundle(),
];
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->config);
}
public function getCacheDir()
{
return sys_get_temp_dir().'/TestBundle';
}
public function serialize()
{
return $this->config;
}
public function unserialize($config)
{
$this->__construct($config);
}
}