1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the Elcodi package. |
5
|
|
|
* |
6
|
|
|
* Copyright (c) 2014 Elcodi.com |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* Feel free to edit as you please, and have fun. |
12
|
|
|
* |
13
|
|
|
* @author Marc Morera <[email protected]> |
14
|
|
|
* @author Aldo Chiecchia <[email protected]> |
15
|
|
|
* @author Dan Kempster <[email protected]> |
16
|
|
|
*/ |
17
|
|
|
namespace Axstrad\Bundle\TestBundle\Functional; |
18
|
|
|
|
19
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
20
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
21
|
|
|
|
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Axstrad\Bundle\TestBundle\Functional\AbstractAxstradKernel |
25
|
|
|
*/ |
26
|
|
|
abstract class AbstractAxstradKernel extends Kernel |
27
|
|
|
{ |
28
|
|
|
protected $testInfo = array(); |
29
|
|
|
|
30
|
|
|
protected $phpunitDebug = false; |
31
|
|
|
|
32
|
|
|
private $uniqueAppDir = null; |
33
|
|
|
|
34
|
|
|
public function __construct($environment, $debug, array $testInfo) |
35
|
|
|
{ |
36
|
|
|
$this->testInfo = $testInfo; |
37
|
|
|
|
38
|
|
|
parent::__construct($environment, $debug); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Register container configuration |
43
|
|
|
* |
44
|
|
|
* @param LoaderInterface $loader Loader |
45
|
|
|
*/ |
46
|
|
|
public function registerContainerConfiguration(LoaderInterface $loader) |
47
|
|
|
{ |
48
|
|
|
$classInfo = new \ReflectionClass($this); |
49
|
|
|
$dir = dirname($classInfo->getFileName()); |
50
|
|
|
$loader->load($dir . '/config.yml'); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
protected function getUniqueAppDir() |
54
|
|
|
{ |
55
|
|
|
if ($this->uniqueAppDir === null) { |
56
|
|
|
$this->uniqueAppDir = sys_get_temp_dir() . |
57
|
|
|
DIRECTORY_SEPARATOR . |
58
|
|
|
'AxstradTestBundleCache'. |
59
|
|
|
DIRECTORY_SEPARATOR . |
60
|
|
|
$this->getEnvironment() |
61
|
|
|
; |
62
|
|
|
|
63
|
|
|
// if (in_array('--debug', $_SERVER['argv'])) { |
64
|
|
|
// echo 'App Dir: '.$this->uniqueAppDir."\n"; |
65
|
|
|
// } |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
return $this->uniqueAppDir; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Return Cache dir |
73
|
|
|
* |
74
|
|
|
* @return string |
75
|
|
|
*/ |
76
|
|
|
public function getCacheDir() |
77
|
|
|
{ |
78
|
|
|
return $this->getUniqueAppDir() . '/Cache/'; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Return log dir |
83
|
|
|
* |
84
|
|
|
* @return string |
85
|
|
|
*/ |
86
|
|
|
public function getLogDir() |
87
|
|
|
{ |
88
|
|
|
return $this->getUniqueAppDir() . '/Log/'; |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|