当前位置: 首页>>代码示例>>PHP>>正文


PHP App\Bootstrap类代码示例

本文整理汇总了PHP中Magento\Framework\App\Bootstrap的典型用法代码示例。如果您正苦于以下问题:PHP Bootstrap类的具体用法?PHP Bootstrap怎么用?PHP Bootstrap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Bootstrap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: define

<?php

/**
 * Register basic autoloader that uses include path
 *
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
use Magento\Framework\Autoload\AutoloaderRegistry;
use Magento\Framework\Autoload\ClassLoaderWrapper;
/**
 * Shortcut constant for the root directory
 */
define('BP', dirname(__DIR__));
$vendorDir = (require BP . '/app/etc/vendor_path.php');
$vendorAutoload = BP . "/{$vendorDir}/autoload.php";
/* 'composer install' validation */
if (file_exists($vendorAutoload)) {
    $composerAutoloader = (include $vendorAutoload);
} else {
    throw new \Exception('Vendor autoload is not found. Please run \'composer install\' under application root directory.');
}
AutoloaderRegistry::registerAutoloader(new ClassLoaderWrapper($composerAutoloader));
// Sets default autoload mappings, may be overridden in Bootstrap::create
\Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:25,代码来源:autoload.php

示例2: getApplicationCommands

 /**
  * Gets application commands
  *
  * @return array
  */
 protected function getApplicationCommands()
 {
     $commands = [];
     try {
         $bootstrapParam = new ComplexParameter(self::INPUT_KEY_BOOTSTRAP);
         $params = $bootstrapParam->mergeFromArgv($_SERVER, $_SERVER);
         $params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
         $bootstrap = Bootstrap::create(BP, $params);
         $objectManager = $bootstrap->getObjectManager();
         /** @var \Magento\Setup\Model\ObjectManagerProvider $omProvider */
         $omProvider = $this->serviceManager->get('Magento\\Setup\\Model\\ObjectManagerProvider');
         $omProvider->setObjectManager($objectManager);
         if (class_exists('Magento\\Setup\\Console\\CommandList')) {
             $setupCommandList = new \Magento\Setup\Console\CommandList($this->serviceManager);
             $commands = array_merge($commands, $setupCommandList->getCommands());
         }
         if ($objectManager->get('Magento\\Framework\\App\\DeploymentConfig')->isAvailable()) {
             /** @var \Magento\Framework\Console\CommandList $commandList */
             $commandList = $objectManager->create('Magento\\Framework\\Console\\CommandList');
             $commands = array_merge($commands, $commandList->getCommands());
         }
         $commands = array_merge($commands, $this->getVendorCommands($objectManager));
     } catch (\Exception $e) {
         $this->initException = $e;
     }
     return $commands;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:32,代码来源:Cli.php

示例3: getObjectManagerFactory

 /**
  * Returns ObjectManagerFactory
  *
  * @param array $initParams
  * @return \Magento\Framework\App\ObjectManagerFactory
  */
 public function getObjectManagerFactory($initParams = [])
 {
     return Bootstrap::createObjectManagerFactory(
         BP,
         $initParams
     );
 }
开发者ID:nja78,项目名称:magento2,代码行数:13,代码来源:ObjectManagerProvider.php

示例4: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     self::$root = BP;
     self::$rootJson = json_decode(file_get_contents(self::$root . '/composer.json'), true);
     self::$dependencies = [];
     self::$objectManager = Bootstrap::create(BP, $_SERVER)->getObjectManager();
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:7,代码来源:ComposerTest.php

示例5: tearDown

 protected function tearDown()
 {
     unset($this->model);
     $magentoObjectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER);
     $objectManager = $magentoObjectManagerFactory->create($_SERVER);
     \Magento\Framework\App\ObjectManager::setInstance($objectManager);
 }
开发者ID:nja78,项目名称:magento2,代码行数:7,代码来源:HttpTest.php

示例6: initObjectManager

 /**
  * Initialize Magento ObjectManager.
  *
  * @return void
  */
 protected function initObjectManager()
 {
     if (!$this->magentoObjectManager) {
         $objectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER);
         $this->magentoObjectManager = $objectManagerFactory->create($_SERVER);
     }
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:12,代码来源:SequenceSorter.php

示例7: getApplicationCommands

 /**
  * Gets application commands
  *
  * @return array
  */
 protected function getApplicationCommands()
 {
     $setupCommands = [];
     $toolsCommands = [];
     $modulesCommands = [];
     $bootstrapParam = new ComplexParameter(self::INPUT_KEY_BOOTSTRAP);
     $params = $bootstrapParam->mergeFromArgv($_SERVER, $_SERVER);
     $params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
     $bootstrap = Bootstrap::create(BP, $params);
     $objectManager = $bootstrap->getObjectManager();
     if (class_exists('Magento\\Setup\\Console\\CommandList')) {
         $serviceManager = \Zend\Mvc\Application::init(require BP . '/setup/config/application.config.php')->getServiceManager();
         $setupCommandList = new \Magento\Setup\Console\CommandList($serviceManager);
         $setupCommands = $setupCommandList->getCommands();
     }
     if (class_exists('Magento\\Tools\\Console\\CommandList')) {
         $toolsCommandList = new \Magento\Tools\Console\CommandList();
         $toolsCommands = $toolsCommandList->getCommands();
     }
     if ($objectManager->get('Magento\\Framework\\App\\DeploymentConfig')->isAvailable()) {
         $commandList = $objectManager->create('Magento\\Framework\\Console\\CommandList');
         $modulesCommands = $commandList->getCommands();
     }
     $commandsList = array_merge($setupCommands, $toolsCommands, $modulesCommands);
     return $commandsList;
 }
开发者ID:nja78,项目名称:magento2,代码行数:31,代码来源:Cli.php

示例8: createProcessor

 /**
  * Create Processor
  *
  * @return Processor
  */
 public function createProcessor()
 {
     $objectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER);
     $objectManager = $objectManagerFactory->create($_SERVER);
     $response = $objectManager->create('Magento\\Framework\\App\\Response\\Http');
     return new Processor($response);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:processorFactory.php

示例9: setUp

 /**
  * 2016-11-03
  * @override
  * @see \PHPUnit\Framework\TestCase::setUp()
  * @return void
  */
 protected function setUp()
 {
     if (!self::$r) {
         self::$r = true;
         Bootstrap::create(BP, $_SERVER)->createApplication(Http::class);
         df_app_state()->setAreaCode('frontend');
     }
 }
开发者ID:mage2pro,项目名称:core,代码行数:14,代码来源:TestCase.php

示例10: testCreateFilesystemDriverPool

 public function testCreateFilesystemDriverPool()
 {
     $driverClass = get_class($this->getMockForAbstractClass('Magento\\Framework\\Filesystem\\DriverInterface'));
     $result = Bootstrap::createFilesystemDriverPool([Bootstrap::INIT_PARAM_FILESYSTEM_DRIVERS => ['custom' => $driverClass]]);
     /** @var \Magento\Framework\Filesystem\DriverPool $result */
     $this->assertInstanceOf('Magento\\Framework\\Filesystem\\DriverPool', $result);
     $this->assertInstanceof($driverClass, $result->getDriver('custom'));
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:8,代码来源:BootstrapTest.php

示例11: bootstrapMage2

 /**
  * Bootstraps Magento2
  */
 public function bootstrapMage2()
 {
     if (is_null($this->bootstrap)) {
         $bootstrap = Bootstrap::create(BP, $_SERVER);
         $bootstrap->getObjectManager();
         $this->bootstrap = true;
     }
 }
开发者ID:nagno,项目名称:phpspec-bootstrap-magento2,代码行数:11,代码来源:BootstrapMaintainer.php

示例12: setUp

 /**
  * Setup method
  */
 protected function setUp()
 {
     $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
     $app = $bootstrap->createApplication('Magento\\Framework\\App\\Http');
     $bootstrap->run($app);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->objectManager = ObjectManager::getInstance();
 }
开发者ID:yireo,项目名称:Yireo_GoogleTagManager2,代码行数:11,代码来源:Generic.php

示例13: get

 /**
  * Retrieve object manager.
  *
  * @return \Magento\Framework\ObjectManagerInterface
  * @throws \Magento\Setup\Exception
  */
 public function get()
 {
     if (null === $this->objectManager) {
         $initParams = $this->serviceLocator->get(InitParamListener::BOOTSTRAP_PARAM);
         $factory = Bootstrap::createObjectManagerFactory(BP, $initParams);
         $this->objectManager = $factory->create($initParams);
     }
     return $this->objectManager;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:15,代码来源:ObjectManagerProvider.php

示例14: getConfig

 /**
  * Return configuration for the tests
  *
  * @return \Magento\TestFramework\Performance\Config
  */
 public function getConfig()
 {
     if (null === $this->config) {
         $configFile = "{$this->testsBaseDir}/config.php";
         $configFile = file_exists($configFile) ? $configFile : "{$configFile}.dist";
         $configData = (require $configFile);
         $this->config = new Config($configData, $this->testsBaseDir, $this->appBootstrap->getDirList()->getRoot());
     }
     return $this->config;
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:15,代码来源:Bootstrap.php

示例15: testIsAdmin

 /**
  * @test
  * @covers \Yireo\NewRelic2\Helper\Data::isAdmin
  */
 public function testIsAdmin()
 {
     $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
     /** @var \Magento\Framework\App\Http $app */
     $bootstrap->createApplication('Magento\\Framework\\App\\Http');
     $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
     $appState = $objectManager->get('Magento\\Framework\\App\\State');
     $backendAreaCode = \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE;
     $appState->setAreaCode($backendAreaCode);
     $this->assertTrue($this->targetHelper->isAdmin());
 }
开发者ID:baisoo,项目名称:Yireo_NewRelic2,代码行数:15,代码来源:DataTest.php


注:本文中的Magento\Framework\App\Bootstrap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。