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


PHP Bootstrap::create方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: initMagento

 public function initMagento()
 {
     $bootstrapPath = $this->config->getMagentoBootstrapPath();
     if (!file_exists($bootstrapPath)) {
         throw new \RuntimeException(sprintf("Magento's bootstrap file was not found at path '%s'", $bootstrapPath));
     }
     include $bootstrapPath;
     $params = $_SERVER;
     $params[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] = [DirectoryList::PUB => [DirectoryList::URL_PATH => ''], DirectoryList::MEDIA => [DirectoryList::URL_PATH => 'media'], DirectoryList::STATIC_VIEW => [DirectoryList::URL_PATH => 'static'], DirectoryList::UPLOAD => [DirectoryList::URL_PATH => 'media/upload']];
     putenv('BEHAT_RUNNING=true');
     $bootstrap = Bootstrap::create(BP, $params);
     $app = $bootstrap->createApplication('Magento\\Framework\\App\\Http');
     $app->launch();
     ObjectManager::getInstance();
     $this->magentoConfigManager = new MagentoConfigManager();
     $this->magentoConfigManager->changeConfigs($this->config->getRequiredMagentoConfig());
 }
开发者ID:tkotosz,项目名称:behat-magento2-init,代码行数:17,代码来源:Magento2InitListener.php

示例9: testUnitTestFilesPlacement

 public function testUnitTestFilesPlacement()
 {
     $objectManager = Bootstrap::create(BP, $_SERVER)->getObjectManager();
     /** @var \Magento\Framework\Data\Collection\Filesystem $filesystem */
     $filesystem = $objectManager->get('Magento\\Framework\\Data\\Collection\\Filesystem');
     $filesystem->setCollectDirs(false)->setCollectFiles(true)->setCollectRecursively(true);
     $targetsExist = false;
     foreach ($this->scanList as $dir) {
         if (realpath($this->root . DIRECTORY_SEPARATOR . $dir)) {
             $filesystem->addTargetDir($this->root . DIRECTORY_SEPARATOR . $dir);
             $targetsExist = true;
         }
     }
     if ($targetsExist) {
         $files = $filesystem->load()->toArray();
         $fileList = [];
         foreach ($files['items'] as $file) {
             $fileList[] = $file['filename'];
         }
         $this->assertEquals(0, $files['totalRecords'], "The following files have been found in obsolete test directories: \n" . implode("\n", $fileList));
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:22,代码来源:TestPlacementTest.php

示例10: dirname

/**
 * Performance framework bootstrap script
 *
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
$testsBaseDir = dirname(__DIR__);
require __DIR__ . '/../../../../app/bootstrap.php';
$appBootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
(new \Magento\Framework\Autoload\IncludePath())->addIncludePath($testsBaseDir . '/framework');
$bootstrap = new \Magento\TestFramework\Performance\Bootstrap($appBootstrap, $testsBaseDir);
$bootstrap->cleanupReports();
return $bootstrap;
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:31,代码来源:bootstrap.php

示例11: catch

<?php

/**
 * Public alias for the application entry point
 *
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
use Magento\Framework\App\Bootstrap;
use Magento\Framework\App\Filesystem\DirectoryList;
try {
    require __DIR__ . '/../app/bootstrap.php';
} catch (\Exception $e) {
    echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
    <div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
        <h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;">
        Autoload error</h3>
    </div>
    <p>{$e->getMessage()}</p>
</div>
HTML;
    exit(1);
}
$params = $_SERVER;
$params[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] = [DirectoryList::PUB => [DirectoryList::URL_PATH => ''], DirectoryList::MEDIA => [DirectoryList::URL_PATH => 'media'], DirectoryList::STATIC_VIEW => [DirectoryList::URL_PATH => 'static'], DirectoryList::UPLOAD => [DirectoryList::URL_PATH => 'media/upload']];
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\\Framework\\App\\Http');
$bootstrap->run($app);
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:30,代码来源:index.php

示例12: _initMagento2

 /**
  * @return void
  */
 protected function _initMagento2()
 {
     require_once $this->getMagentoRootFolder() . '/app/bootstrap.php';
     $params = $_SERVER;
     $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'admin';
     $params[\Magento\Store\Model\Store::CUSTOM_ENTRY_POINT_PARAM] = true;
     $params['entryPoint'] = basename(__FILE__);
     $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
     /** @var \Magento\Framework\App\Cron $app */
     $app = $bootstrap->createApplication('N98\\Magento\\Framework\\App\\Magerun', []);
     /* @var $app \N98\Magento\Framework\App\Magerun */
     $app->launch();
     $this->_objectManager = $app->getObjectManager();
 }
开发者ID:jsiefer,项目名称:n98-magerun2,代码行数:17,代码来源:Application.php

示例13: getopt

<?php

/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
use Magento\Framework\App\Bootstrap;
use Magento\Framework\App\State;
use Magento\Framework\Shell\ComplexParameter;
require_once __DIR__ . '/../../../../../app/bootstrap.php';
$usage = 'Usage: php -f install.php -- --admin_username= [--bootstrap=]
    --admin_username - store\'s admin username. Required for installation.
    [--bootstrap] - add or override parameters of the bootstrap' . PHP_EOL;
$data = getopt('', ['admin_username:', 'bootstrap::']);
if (!isset($data['admin_username']) || empty($data['admin_username'])) {
    echo $usage;
    exit(1);
}
$bootstrapParam = new ComplexParameter('bootstrap');
$params = $bootstrapParam->mergeFromArgv($_SERVER, $_SERVER);
$params[Bootstrap::PARAM_REQUIRE_MAINTENANCE] = null;
$params[State::PARAM_MODE] = State::MODE_DEVELOPER;
$bootstrap = Bootstrap::create(BP, $params);
$app = $bootstrap->createApplication('Magento\\Tools\\SampleData\\InstallerApp', ['data' => $data]);
$bootstrap->run($app);
开发者ID:shabbirvividads,项目名称:magento2,代码行数:25,代码来源:install.php

示例14:

 * $bootstrap = new \Magento\Framework\App\Bootstrap(BP, $_SERVER, $extra);
 * $app = $bootstrap->createApplication('Magento\Framework\App\Http');
 * $bootstrap->run($app);
 * --------------------------------------------
 *
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @copyright  Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
require __DIR__ . '/app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER, null);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\\Framework\\App\\Http');
$bootstrap->run($app);
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:31,代码来源:index.php

示例15: umask

<?php

use Magento\Framework\Autoload\AutoloaderRegistry;
use Magento\Framework\Autoload\ClassLoaderWrapper;
use Magento\Framework\App\State;
umask(0);
error_reporting(E_ALL);
date_default_timezone_set('UTC');
/**
 * Shortcut constant for the root directory
 */
define('BP', dirname(__DIR__));
$autoloader = (require BP . '/vendor/autoload.php');
AutoloaderRegistry::registerAutoloader(new ClassLoaderWrapper($autoloader));
// Sets default autoload mappings, may be overridden in Bootstrap::create
\Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, [State::PARAM_MODE => State::MODE_DEVELOPER]);
return $bootstrap;
开发者ID:EcomDev,项目名称:mysql-performance-benchmark,代码行数:18,代码来源:bootstrap.php


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