Created
June 1, 2013 05:10
-
-
Save joshribakoff/5689343 to your computer and use it in GitHub Desktop.
phpunit bootstrap /zf2 service manager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Zend\ServiceManager\ServiceManager; | |
use Zend\Mvc\Service\ServiceManagerConfig; | |
class phpunit_bootstrap | |
{ | |
static $serviceManager; | |
static function go() | |
{ | |
/** | |
* This makes our life easier when dealing with paths. Everything is relative | |
* to the application root now. | |
*/ | |
chdir(__DIR__); | |
// Setup autoloading | |
require 'init_autoloader.php'; | |
// Run the application! | |
$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; | |
} | |
static public function getServiceManager() | |
{ | |
return self::$serviceManager; | |
} | |
} | |
phpunit_bootstrap::go(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment