|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Zikula package. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright Zikula Foundation - http://zikula.org/ |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Zikula\Bundle\CoreBundle\Tests\Functional; |
|
13
|
|
|
|
|
14
|
|
|
use JMS\TranslationBundle\Exception\RuntimeException; |
|
15
|
|
|
use Symfony\Component\Filesystem\Filesystem; |
|
16
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
|
17
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
|
18
|
|
|
use Zikula\Bundle\CoreBundle\HttpKernel\ZikulaKernel; |
|
19
|
|
|
|
|
20
|
|
|
class AppKernel extends ZikulaKernel |
|
21
|
|
|
{ |
|
22
|
|
|
private $config; |
|
23
|
|
|
|
|
24
|
|
|
public function __construct($config) |
|
25
|
|
|
{ |
|
26
|
|
|
parent::__construct('test', true); |
|
27
|
|
|
|
|
28
|
|
|
$fs = new Filesystem(); |
|
29
|
|
|
if (!$fs->isAbsolutePath($config)) { |
|
30
|
|
|
$config = __DIR__.'/config/'.$config; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
if (!file_exists($config)) { |
|
34
|
|
|
throw new RuntimeException(sprintf('The config file "%s" does not exist.', $config)); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
$this->config = $config; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function registerBundles() |
|
41
|
|
|
{ |
|
42
|
|
|
return [ |
|
43
|
|
|
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(), |
|
44
|
|
|
new \Symfony\Bundle\TwigBundle\TwigBundle(), |
|
45
|
|
|
new \JMS\I18nRoutingBundle\JMSI18nRoutingBundle(), |
|
46
|
|
|
new \JMS\TranslationBundle\JMSTranslationBundle(), |
|
47
|
|
|
new \Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), |
|
48
|
|
|
new \Zikula\Bundle\CoreBundle\Tests\Functional\Fixture\TestBundle\TestBundle(), // contains translation.xml config definitions |
|
49
|
|
|
]; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function registerContainerConfiguration(LoaderInterface $loader) |
|
53
|
|
|
{ |
|
54
|
|
|
$loader->load($this->config); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function serialize() |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->config; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function unserialize($config) |
|
63
|
|
|
{ |
|
64
|
|
|
$this->__construct($config); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* This needs to be set to the 'normal' kernel cache dir |
|
69
|
|
|
* @return string |
|
70
|
|
|
*/ |
|
71
|
|
|
public function getCacheDir() |
|
72
|
|
|
{ |
|
73
|
|
|
return __DIR__ . '/../../../../../../app/cache/test'; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/* |
|
77
|
|
|
* This needs to be set to the 'normal' kernel logs dir |
|
78
|
|
|
*/ |
|
79
|
|
|
public function getLogDir() |
|
80
|
|
|
{ |
|
81
|
|
|
return __DIR__ . '/../../../../../../app/logs'; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* {@inheritdoc} |
|
86
|
|
|
* |
|
87
|
|
|
* @throws \RuntimeException if a custom resource is hidden by a resource in a derived bundle |
|
88
|
|
|
*/ |
|
89
|
|
|
public function locateResource($name, $dir = null, $first = true) |
|
90
|
|
|
{ |
|
91
|
|
|
return Kernel::locateResource($name, $dir, $first); |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|