1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Heri\Bundle\JobQueueBundle\Tests; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Annotations\AnnotationRegistry; |
6
|
|
|
|
7
|
|
|
// get the autoload file |
8
|
|
|
$dir = __DIR__; |
9
|
|
|
$lastDir = null; |
10
|
|
|
while ($dir !== $lastDir) { |
11
|
|
|
$lastDir = $dir; |
12
|
|
|
|
13
|
|
|
if (is_file($dir.'/autoload.php')) { |
14
|
|
|
require_once $dir.'/autoload.php'; |
15
|
|
|
break; |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
if (is_file($dir.'/autoload.php.dist')) { |
19
|
|
|
require_once $dir.'/autoload.php.dist'; |
20
|
|
|
break; |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
$dir = dirname($dir); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
AnnotationRegistry::registerFile(__DIR__.'/../../../vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'); |
27
|
|
|
|
28
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
29
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* App Test Kernel for functional tests. |
33
|
|
|
*/ |
34
|
|
|
class AppKernel extends Kernel |
35
|
|
|
{ |
36
|
|
|
public function __construct($environment, $debug) |
37
|
|
|
{ |
38
|
|
|
parent::__construct($environment, $debug); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function registerBundles() |
42
|
|
|
{ |
43
|
|
|
return array( |
44
|
|
|
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(), |
45
|
|
|
new \Heri\Bundle\JobQueueBundle\HeriJobQueueBundle(), |
46
|
|
|
new \Symfony\Bundle\MonologBundle\MonologBundle(), |
47
|
|
|
new \Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), |
48
|
|
|
); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function init() |
52
|
|
|
{ |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function getRootDir() |
56
|
|
|
{ |
57
|
|
|
return __DIR__; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function getCacheDir() |
61
|
|
|
{ |
62
|
|
|
return sys_get_temp_dir().'/'.Kernel::VERSION.'/heri-jobqueue/cache/'.$this->environment; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function getLogDir() |
66
|
|
|
{ |
67
|
|
|
return sys_get_temp_dir().'/'.Kernel::VERSION.'/heri-jobqueue/logs'; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function registerContainerConfiguration(LoaderInterface $loader) |
71
|
|
|
{ |
72
|
|
|
$loader->load(__DIR__.'/config/'.$this->environment.'.yml'); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function serialize() |
76
|
|
|
{ |
77
|
|
|
return serialize(array($this->getEnvironment(), $this->isDebug())); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function unserialize($str) |
81
|
|
|
{ |
82
|
|
|
call_user_func_array(array($this, '__construct'), unserialize($str)); |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|