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


PHP ObjectManagerInterface::addSharedInstance方法代码示例

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


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

示例1: setUpThemeFallback

 /**
  * Setup the theme fallback structure and set the Vendor/custom_theme as the current theme for 'fixturestore' store
  *
  * @param $area
  */
 protected function setUpThemeFallback($area)
 {
     $themes = ['frontend' => 'Vendor/custom_theme'];
     $design = $this->_objectManager->create('Magento\\Theme\\Model\\View\\Design', ['themes' => $themes]);
     $this->_objectManager->addSharedInstance($design, 'Magento\\Theme\\Model\\View\\Design');
     // It is important to test from both areas, as emails will get sent from both, so we need to ensure that the
     // inline CSS files get loaded properly from both areas.
     \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea($area);
     $collection = $this->_objectManager->create('Magento\\Theme\\Model\\Resource\\Theme\\Collection');
     // Hard-coding theme as we want to test the fallback structure to ensure that the parent/grandparent themes of
     // Vendor/custom_theme will be checked for CSS files
     $themeId = $collection->getThemeByFullPath('frontend/Vendor/custom_theme')->getId();
     $this->_objectManager->get('Magento\\Framework\\App\\Config\\MutableScopeConfigInterface')->setValue(\Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID, $themeId, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, 'fixturestore');
     $this->_model->setDesignConfig(['area' => 'frontend', 'store' => $this->_objectManager->get('Magento\\Store\\Model\\StoreManagerInterface')->getStore('fixturestore')->getId()]);
 }
开发者ID:niranjanssiet,项目名称:magento2,代码行数:20,代码来源:TemplateTest.php

示例2: setUpAdminThemeFallback

 /**
  * Setup the theme fallback structure and set the Vendor_EmailTest/custom_theme as the current theme for
  * 'fixturestore' store
  */
 protected function setUpAdminThemeFallback()
 {
     $themes = [BackendFrontNameResolver::AREA_CODE => 'Vendor_EmailTest/custom_theme'];
     $design = $this->objectManager->create('Magento\\Theme\\Model\\View\\Design', ['themes' => $themes]);
     $this->objectManager->addSharedInstance($design, 'Magento\\Theme\\Model\\View\\Design');
     /** @var \Magento\Theme\Model\Theme\Registration $registration */
     $registration = $this->objectManager->get('Magento\\Theme\\Model\\Theme\\Registration');
     $registration->register();
     // The Vendor_EmailTest/custom_theme adminhtml theme is set in the
     // dev/tests/integration/testsuite/Magento/Email/Model/_files/design/themes.php file, as it must be set
     // before the adminhtml area is loaded below.
     Bootstrap::getInstance()->loadArea(BackendFrontNameResolver::AREA_CODE);
     /** @var \Magento\Store\Model\Store $adminStore */
     $adminStore = $this->objectManager->create('Magento\\Store\\Model\\Store')->load(Store::ADMIN_CODE);
     $this->model->setDesignConfig(['area' => 'adminhtml', 'store' => $adminStore->getId()]);
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:20,代码来源:TemplateTest.php


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