1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the OverblogGraphQLBundle package. |
5
|
|
|
* |
6
|
|
|
* (c) Overblog <http://github.com/overblog/> |
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 Overblog\GraphQLBundle\Tests\Functional\App; |
13
|
|
|
|
14
|
|
|
use Overblog\GraphQLBundle\OverblogGraphQLBundle; |
15
|
|
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; |
16
|
|
|
use Symfony\Bundle\SecurityBundle\SecurityBundle; |
17
|
|
|
use Symfony\Bundle\TwigBundle\TwigBundle; |
18
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
19
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
20
|
|
|
|
21
|
|
|
final class TestKernel extends Kernel |
22
|
|
|
{ |
23
|
|
|
private $testCase; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* {@inheritdoc} |
27
|
|
|
*/ |
28
|
|
|
public function registerBundles() |
29
|
|
|
{ |
30
|
|
|
return [ |
31
|
|
|
new FrameworkBundle(), |
32
|
|
|
new SecurityBundle(), |
33
|
|
|
new TwigBundle(), |
34
|
|
|
new OverblogGraphQLBundle(), |
35
|
|
|
]; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function __construct($environment, $debug, $testCase = null) |
39
|
|
|
{ |
40
|
|
|
$this->testCase = null !== $testCase ? $testCase : false; |
41
|
|
|
parent::__construct($environment, $debug); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function getCacheDir() |
45
|
|
|
{ |
46
|
|
|
return sys_get_temp_dir().'/OverblogGraphQLBundle/'.Kernel::VERSION.'/'.$this->testCase.'/cache/'.$this->environment; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function getLogDir() |
50
|
|
|
{ |
51
|
|
|
return sys_get_temp_dir().'/OverblogGraphQLBundle/'.Kernel::VERSION.'/'.$this->testCase.'/logs'; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function getRootDir() |
55
|
|
|
{ |
56
|
|
|
return __DIR__; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function isBooted() |
60
|
|
|
{ |
61
|
|
|
return $this->booted; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* {@inheritdoc} |
66
|
|
|
*/ |
67
|
|
|
public function registerContainerConfiguration(LoaderInterface $loader) |
68
|
|
|
{ |
69
|
|
|
if ($this->testCase) { |
70
|
|
|
$loader->load(sprintf(__DIR__.'/config/%s/config.yml', $this->testCase)); |
71
|
|
|
} else { |
72
|
|
|
$loader->load(__DIR__.'/config/config.yml'); |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|