forked from zendframework/modules.zendframework.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bootstrap.php
51 lines (41 loc) · 1.41 KB
/
Bootstrap.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
<?php
namespace EdpGithubTest;
use Zend\Loader\AutoloaderFactory;
use Zend\Mvc\Service\ServiceManagerConfig;
use Zend\ServiceManager\ServiceManager;
use Zend\Stdlib\ArrayUtils;
use RuntimeException;
error_reporting(E_ALL | E_STRICT);
chdir(__DIR__);
class Bootstrap
{
protected static $serviceManager;
public static function init()
{
// Load the user-defined test configuration file, if it exists; otherwise, load
$config = include __DIR__ . '/config/application.config.php';
static::initAutoloader();
$serviceManager = new ServiceManager(new ServiceManagerConfig());
$serviceManager->setService('ApplicationConfig', $config);
$serviceManager->get('ModuleManager')->loadModules();
static::$serviceManager = $serviceManager;
}
public static function getServiceManager()
{
return static::$serviceManager;
}
protected static function initAutoloader()
{
$loader = include __DIR__ . '/init_autoloader.php';
AutoloaderFactory::factory(array(
'Zend\Loader\StandardAutoloader' => array(
'autoregister_zf' => true,
'namespaces' => array(
'ApplicationTest' => __DIR__ . '/module/Application/test/ApplicationTest',
'UserTest' => __DIR__ . '/module/User/test/UserTest',
),
),
));
}
}
Bootstrap::init();