private static function _buildServiceContainer()
 {
     /**
      * First, record the root path.
      */
     if (!defined('TUBEPRESS_ROOT')) {
         define('TUBEPRESS_ROOT', self::_calculateTubePressRoot());
     }
     if (!defined('TUBEPRESS_VERSION')) {
         /**
          * This is set to the actual version during packaging.
          */
         define('TUBEPRESS_VERSION', '99.99.99');
     }
     if (!isset(self::$_PRIMARY_BOOTSTRAPPER)) {
         /**
          * Finally, load the primary bootstrapper and use it to obtain the service container.
          */
         if (!class_exists('tubepress_internal_boot_PrimaryBootstrapper', false)) {
             require TUBEPRESS_ROOT . '/src/php/classes/internal/tubepress/internal/boot/PrimaryBootstrapper.php';
         }
         self::$_PRIMARY_BOOTSTRAPPER = new tubepress_internal_boot_PrimaryBootstrapper();
     }
     self::$SERVICE_CONTAINER = self::$_PRIMARY_BOOTSTRAPPER->getServiceContainer();
 }
 public function testBootException()
 {
     $this->setExpectedException('RuntimeException', 'hellooo!');
     $this->_mockContainerSupplier->shouldReceive('getServiceContainer')->once()->andThrow(new RuntimeException('hellooo!'));
     $this->_mockBootLogger->shouldReceive('handleBootException')->once();
     $this->_mockBootLogger->shouldReceive('onBootComplete')->once();
     $validator = function ($arg) {
         $stringUtils = new tubepress_util_impl_StringUtils();
         return $stringUtils->startsWith($arg, '<code>');
     };
     $this->_mockBootLogger->shouldReceive('error')->atLeast(1)->with(Mockery::on($validator));
     $this->_bootSettings->shouldReceive('shouldClearCache')->once()->andReturn(false);
     $this->_sut->getServiceContainer();
 }
 private function _handleBootException(Exception $e)
 {
     if ($this->_bootLogger->isEnabled()) {
         /**
          * Print everything out, including a stack trace.
          */
         $this->_bootLogger->handleBootException($e);
         $this->_bootLogger->onBootComplete();
     }
     self::$_BOOT_EXCEPTION = $e;
     throw $e;
 }