Example #1
0
 protected function setUp()
 {
     $this->router = new Router();
     if (!defined('SRC_DIR')) {
         define('SRC_DIR', __DIR__ . '/Fixtures/src');
     }
     if (!defined('DS')) {
         define('DS', '/');
     }
     $bundles = [new AppBundle(), new TestBundle()];
     Bundles::loadAll($bundles);
 }
Example #2
0
 /**
  * Init application
  *
  * @throws BaseException
  * @throws DependencyInjection\Exception
  */
 protected function init()
 {
     $error = new ErrorHandler();
     $error->setHandler(new JsonHandler())->setDebug(true)->register();
     DotEnv::load(ROOT_DIR);
     if (!getenv('RAD_ENVIRONMENT')) {
         putenv('RAD_ENVIRONMENT=production');
     }
     $this->container = Container::getInstance();
     Config::set('environment', getenv('RAD_ENVIRONMENT'));
     Config::set('debug', (bool) getenv('RAD_DEBUG'));
     Bundles::loadAll($this->registerBundles());
     $this->container->setShared('event_manager', new EventManager(), true);
     $this->loadConfig();
     $this->loadService();
     $this->loadServicesFromConfig();
     $this->container->setShared('router', new Router());
     $this->bundleStartup();
 }