load() публичный Метод

public load ( )
Пример #1
0
 /**
  * @test
  */
 public function loader()
 {
     $config = new Config();
     try {
         $config->load();
         $this->fail('An expected exception was not thrown');
     } catch (ErrorException $e) {
         $this->assertEquals('Configuration not yet fully loaded', $e->getMessage());
     }
     $this->assertEquals(array(), $config->getConfig());
     $loader = $config->getLoader();
     $this->assertInstanceOf(__NAMESPACE__ . '\\ConfigurationLoader', $loader);
     $this->assertSame($loader, $config->getLoader());
     $loader->loadStageTwo("");
     $config->load();
     $this->assertInternalType('array', $config->getConfig());
     $this->assertGreaterThan(4, count($config->getConfig()));
     $config->setLoader($loader);
 }
Пример #2
0
 /**
  * @param array $initConfig
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return void
  */
 public function init(array $initConfig = array(), InputInterface $input = null, OutputInterface $output = null)
 {
     if ($this->_isInitialized) {
         return;
     }
     // Suppress DateTime warnings
     date_default_timezone_set(@date_default_timezone_get());
     // Initialize EventDispatcher early
     $this->dispatcher = new EventDispatcher();
     $this->setDispatcher($this->dispatcher);
     if (null === $input) {
         $input = new ArgvInput();
     }
     if (null === $output) {
         $output = new ConsoleOutput();
     }
     if (null !== $this->config) {
         throw new UnexpectedValueException(sprintf('Config already initialized'));
     }
     $loadExternalConfig = !$this->_checkSkipConfigOption();
     $this->config = $config = new Config($initConfig, $this->isPharMode(), $output);
     $configLoader = $config->getLoader();
     $config->loadPartialConfig($loadExternalConfig);
     $this->detectMagento($input, $output);
     $configLoader->loadStageTwo($this->_magentoRootFolder, $loadExternalConfig, $this->_magerunStopFileFolder);
     $config->load();
     if ($autoloader = $this->autoloader) {
         /**
          * Include commands shipped by Magento 2 core
          */
         if (!$this->_checkSkipMagento2CoreCommandsOption()) {
             $this->registerMagentoCoreCommands($output);
         }
         $this->config->registerCustomAutoloaders($autoloader);
         $this->registerEventSubscribers();
         $config->registerCustomCommands($this);
     }
     $this->registerHelpers();
     $this->_isInitialized = true;
 }
Пример #3
0
 /**
  * @param array $initConfig [optional]
  * @param InputInterface $input [optional]
  * @param OutputInterface $output [optional]
  *
  * @return void
  */
 public function init(array $initConfig = array(), InputInterface $input = null, OutputInterface $output = null)
 {
     if ($this->_isInitialized) {
         return;
     }
     // Suppress DateTime warnings
     date_default_timezone_set(@date_default_timezone_get());
     // Initialize EventDispatcher early
     $this->dispatcher = new EventDispatcher();
     $this->setDispatcher($this->dispatcher);
     $input = $input ?: new ArgvInput();
     $output = $output ?: new ConsoleOutput();
     if (null !== $this->config) {
         throw new UnexpectedValueException(sprintf('Config already initialized'));
     }
     $loadExternalConfig = !$input->hasParameterOption('--skip-config');
     $this->config = $config = new Config($initConfig, $this->isPharMode(), $output);
     if ($this->configurationLoaderInjected) {
         $config->setLoader($this->configurationLoaderInjected);
     }
     $config->loadPartialConfig($loadExternalConfig);
     $this->detectMagento($input, $output);
     $configLoader = $config->getLoader();
     $configLoader->loadStageTwo($this->_magentoRootFolder, $loadExternalConfig, $this->_magerunStopFileFolder);
     $config->load();
     if ($autoloader = $this->autoloader) {
         $config->registerCustomAutoloaders($autoloader);
         $this->registerEventSubscribers();
         $config->registerCustomCommands($this);
     }
     $this->registerHelpers();
     $this->_isInitialized = true;
 }