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 testGetServiceContainer()
 {
     $mockBootstrapper = Mockery::mock('tubepress_internal_boot_PrimaryBootstrapper');
     $mockContainer = Mockery::mock('tubepress_api_ioc_ContainerInterface');
     tubepress_internal_boot_InitialBootstrapper::__setPrimaryBootstrapper($mockBootstrapper);
     $mockBootstrapper->shouldReceive('getServiceContainer')->once()->andReturn($mockContainer);
     $this->assertFalse(defined('TUBEPRESS_ROOT'));
     $this->assertFalse(defined('TUBEPRESS_VERSION'));
     $actual1 = tubepress_internal_boot_InitialBootstrapper::getServiceContainer();
     $actual2 = tubepress_internal_boot_InitialBootstrapper::getServiceContainer();
     $this->assertSame($mockContainer, $actual1);
     $this->assertSame($mockContainer, $actual2);
     $this->assertTrue(defined('TUBEPRESS_ROOT'));
     $this->assertTrue(defined('TUBEPRESS_VERSION'));
     $actualTubePressRoot = realpath(TUBEPRESS_ROOT);
     $expectedTubePressRoot = realpath(__DIR__ . '/../../../../../../../..');
     $this->assertTrue(is_dir($actualTubePressRoot));
     $this->assertTrue(is_dir($expectedTubePressRoot));
     $this->assertEquals($expectedTubePressRoot, $actualTubePressRoot);
     $this->assertEquals('99.99.99', TUBEPRESS_VERSION);
 }
Beispiel #3
0
<?php

/**
 * Copyright 2006 - 2016 TubePress LLC (http://tubepress.com)
 *
 * This file is part of TubePress (http://tubepress.com)
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
if (!class_exists('tubepress_internal_boot_InitialBootstrapper', false)) {
    require __DIR__ . '/../classes/internal/tubepress/internal/boot/InitialBootstrapper.php';
}
return tubepress_internal_boot_InitialBootstrapper::getServiceContainer();