-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpunit-bootstrap.php
38 lines (30 loc) · 1.05 KB
/
phpunit-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
<?php
use Zend\ServiceManager\ServiceManager;
use Zend\Mvc\Service\ServiceManagerConfig;
class phpunit_bootstrap
{
static $serviceManager;
static function go()
{
/** Everything is relative to the application root now. */
chdir(__DIR__);
/** Setup autoloading */
require 'init_autoloader.php';
/** bootstrap ZF2 */
$config = require 'config/application.config.php';
Zend\Mvc\Application::init($config);
$serviceManager = new ServiceManager(new ServiceManagerConfig());
$serviceManager->setService('ApplicationConfig', $config);
$serviceManager->get('ModuleManager')->loadModules();
self::$serviceManager = $serviceManager;
/** Reset the DB */
`mysql --user=root -e "drop database IF EXISTS metator_tests"`;
`mysql --user=root -e "create database metator_tests"`;
`mysql --user=root metator_tests < install.sql`;
}
static public function getServiceManager()
{
return self::$serviceManager;
}
}
phpunit_bootstrap::go();