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


PHP Model\Context类代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     $this->contextMock = $this->getMockBuilder('Magento\\Framework\\Model\\Context')->disableOriginalConstructor()->getMock();
     $this->designMock = $this->getMockBuilder('Magento\\Framework\\View\\DesignInterface')->getMock();
     $this->contextMock->expects($this->once())->method('getEventDispatcher')->willReturn($this->getMockBuilder('Magento\\Framework\\Event\\ManagerInterface')->getMock());
     $this->model = (new ObjectManager($this))->getObject('Magento\\Theme\\Model\\Design\\Backend\\Exceptions', ['context' => $this->contextMock, 'design' => $this->designMock]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:7,代码来源:ExceptionsTest.php

示例2: setUp

 protected function setUp()
 {
     $this->context = $this->getMock('Magento\\Framework\\Model\\Context', ['getEventDispatcher', 'getCacheManager'], [], '', false);
     $this->eventManager = $this->getMock('Magento\\Framework\\Event\\ManagerInterface');
     $this->context->expects($this->any())->method('getEventDispatcher')->will($this->returnValue($this->eventManager));
     $this->cacheManager = $this->getMock('Magento\\Framework\\App\\CacheInterface');
     $this->context->expects($this->any())->method('getCacheManager')->will($this->returnValue($this->cacheManager));
     $this->registry = $this->getMock('Magento\\Framework\\Registry');
     $this->storeManager = $this->getMock('Magento\\Store\\Model\\StoreManagerInterface');
     $this->categoryTreeResource = $this->getMock('Magento\\Catalog\\Model\\Resource\\Category\\Tree', [], [], '', false);
     $this->categoryTreeFactory = $this->getMock('Magento\\Catalog\\Model\\Resource\\Category\\TreeFactory', ['create'], [], '', false);
     $this->categoryRepository = $this->getMock('Magento\\Catalog\\Api\\CategoryRepositoryInterface');
     $this->storeCollectionFactory = $this->getMock('Magento\\Store\\Model\\Resource\\Store\\CollectionFactory', ['create'], [], '', false);
     $this->url = $this->getMock('Magento\\Framework\\UrlInterface');
     $this->productCollectionFactory = $this->getMock('Magento\\Catalog\\Model\\Resource\\Product\\CollectionFactory', ['create'], [], '', false);
     $this->catalogConfig = $this->getMock('Magento\\Catalog\\Model\\Config', [], [], '', false);
     $this->filterManager = $this->getMock('Magento\\Framework\\Filter\\FilterManager', ['translitUrl'], [], '', false);
     $this->flatState = $this->getMock('Magento\\Catalog\\Model\\Indexer\\Category\\Flat\\State', [], [], '', false);
     $this->flatIndexer = $this->getMock('Magento\\Indexer\\Model\\IndexerInterface');
     $this->productIndexer = $this->getMock('Magento\\Indexer\\Model\\IndexerInterface');
     $this->categoryUrlPathGenerator = $this->getMock('Magento\\CatalogUrlRewrite\\Model\\CategoryUrlPathGenerator', [], [], '', false);
     $this->urlFinder = $this->getMock('Magento\\UrlRewrite\\Model\\UrlFinderInterface');
     $this->resource = $this->getMock('Magento\\Catalog\\Model\\Resource\\Category', [], [], '', false);
     $this->indexerRegistry = $this->getMock('Magento\\Indexer\\Model\\IndexerRegistry', ['get'], [], '', false);
     $this->category = $this->getCategoryModel();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:26,代码来源:CategoryTest.php

示例3: __construct

 /**
  *
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Catalog\Block\Product\Context $pcontext
  * @param \Magento\Catalog\Model\Product $productModel
  * @param array $data
  * @ignore_var product
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Model\Context $contextBis, \Wyomind\Core\Helper\Data $coreHelper, array $data = [])
 {
     parent::__construct($context, $data);
     $this->_coreHelper = $coreHelper;
     $this->_cacheManager = $contextBis->getCacheManager();
     $this->_session = $context->getSession();
     if ($this->getRequest()->getParam("namespace")) {
         $namespace = $this->getRequest()->getParam("namespace");
         $wgsActivationKey = $this->getRequest()->getParam("wgs_activation_key");
         $wgsStatus = $this->getRequest()->getParam("wgs_status");
         $wgsVersion = $this->getRequest()->getParam("wgs_version");
         $wgsActivation = $this->getRequest()->getParam("wgs_activation");
         $wgsMessage = $this->getRequest()->getParam("wgs_message");
         $activationKey = $this->_coreHelper->getDefaultConfigUncrypted("{$namespace}/license/activation_key");
         $baseUrl = $this->_coreHelper->getDefaultConfig("web/secure/base_url");
         $registeredVersion = $this->_coreHelper->getDefaultConfig("{$namespace}/license/version");
     } else {
         $this->_message = "<div class='message message-error error'>" . __("Invalid data.") . "</div>";
     }
     if (isset($wgsActivationKey) && $wgsActivationKey == $this->_coreHelper->getStoreConfigUncrypted("{$namespace}/license/activation_key")) {
         if (isset($wgsStatus)) {
             switch ($wgsStatus) {
                 case "success":
                     $this->_coreHelper->setDefaultConfig("{$namespace}/license/version", $wgsVersion);
                     $this->_coreHelper->setDefaultConfig("{$namespace}/license/activation_flag", 0);
                     $this->_coreHelper->setDefaultConfigCrypted("{$namespace}/license/activation_code", $wgsActivation);
                     $this->_coreHelper->setDefaultConfig('advanced/modules_disable_output/Wyomind_' . ucfirst($namespace), 0);
                     $this->_session->setData("update_" . $namespace, "false");
                     $this->_cacheManager->clean(['config']);
                     $this->_message = "<div class='message message-success success'>" . $wgsMessage . "</div>";
                     break;
                 case "error":
                     $this->_message = "<div class='message message-success success'>" . $wgsMessage . "</div>";
                     $this->_coreHelper->setDefaultConfig('advanced/modules_disable_output/Wyomind_' . ucfirst($namespace), 1);
                     $this->_coreHelper->setDefaultConfig("{$namespace}/license/activation_code", "");
                     $this->_cacheManager->clean(['config']);
                     break;
                 case "uninstall":
                     $this->_message = "<div class='message message-success success'>" . $wgsMessage . "</div>";
                     $this->setDefaultConfig("{$namespace}/license/activation_key", "");
                     $this->setDefaultConfig("{$namespace}/license/activation_code", "");
                     $this->setStoreConfig('advanced/modules_disable_output/Wyomind_' . ucfirst($namespace), 1);
                     $this->_cacheManager->clean(['config']);
                     $this->getResponse()->setBody("\n                            <form action='http://www.wyomind.com/license_activation/?method=post' id='license_uninstall' method='post'>\n                                <input type='hidden' type='action' value='uninstall' name='action'>\n                                <input type='hidden' value='" . $baseUrl . "' name='domain'>\n                                <input type='hidden' value='" . $activationKey . "' name='activation_key'>\n                                <input type='hidden' value='" . $registeredVersion . "' name='registered_version'>\n                                <button type='submit'" . __("If nothing happens click here !") . "</button>\n                                <script language='javascript'>\n                                        document.getElementById('license_uninstall').submit();\n                                </script>\n                            </form>");
                     break;
                 default:
                     $this->_message = __("An error occurs while retrieving the license activation (500)");
                     $this->_coreHelper->setDefaultConfig("{$namespace}/license/activation_code", "");
                     $this->_coreHelper->setDefaultConfig('advanced/modules_disable_output/Wyomind_' . ucfirst($namespace), 1);
                     $this->_cacheManager->clean(['config']);
                     break;
             }
         } else {
             $this->_message = "<div class='message message-error error'>" . __("An error occurs while retrieving license activation (404).") . "</div>";
         }
     } else {
         $this->_message = "<div class='message message-error error'>" . __("Invalid activation key.") . "</div>";
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:67,代码来源:Webservice.php

示例4: setUp

 public function setUp()
 {
     $this->contextMock = $this->getMock(
         'Magento\Framework\Model\Context',
         ['getEventDispatcher'],
         [],
         '',
         false
     );
     $eventManagerMock = $this->getMockForAbstractClass(
         'Magento\Framework\Event\ManagerInterface',
         [],
         '',
         false,
         true,
         true,
         ['dispatch']
     );
     $this->contextMock->expects($this->once())
         ->method('getEventDispatcher')
         ->will($this->returnValue($eventManagerMock));
     $this->registryMock = $this->getMock(
         'Magento\Framework\Registry',
         [],
         [],
         '',
         false
     );
     $this->dateTimeMock = $this->getMock(
         'Magento\Framework\Stdlib\DateTime',
         [],
         [],
         '',
         false
     );
     $this->resourceMock = $this->getMockForAbstractClass(
         'Magento\Framework\Model\ResourceModel\AbstractResource',
         [],
         '',
         false,
         true,
         true,
         ['getIdFieldName', 'load', 'selectActiveIntegrationByConsumerId']
     );
     $this->resourceCollectionMock = $this->getMock(
         'Magento\Framework\Data\Collection\AbstractDb',
         [],
         [],
         '',
         false
     );
     $this->integrationModel = new \Magento\Integration\Model\Integration(
         $this->contextMock,
         $this->registryMock,
         $this->dateTimeMock,
         $this->resourceMock,
         $this->resourceCollectionMock
     );
 }
开发者ID:razbakov,项目名称:magento2,代码行数:59,代码来源:IntegrationTest.php

示例5: setUp

 protected function setUp()
 {
     $this->contextMock = $this->getMockBuilder('\\Magento\\Framework\\Model\\Context')->setMethods(['getEventDispatcher'])->disableOriginalConstructor()->getMock();
     $this->eventManagerMock = $this->getMockBuilder('\\Magento\\Framework\\Event\\ManagerInterface')->setMethods(['dispatch'])->getMockForAbstractClass();
     $this->contextMock->expects($this->once())->method('getEventDispatcher')->willReturn($this->eventManagerMock);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->transaction = $this->objectManagerHelper->getObject('\\Magento\\Sales\\Model\\Order\\Payment\\Transaction', ['context' => $this->contextMock]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:8,代码来源:TransactionTest.php

示例6: setUp

 protected function setUp()
 {
     $objectManager = new ObjectManager($this);
     $this->config = $this->getMock('Magento\\Framework\\App\\Config', [], [], '', false);
     $this->eventManager = $this->getMock('Magento\\Framework\\Event\\Manager', [], [], '', false);
     $this->context = $this->getMock('Magento\\Framework\\Model\\Context', ['getEventDispatcher'], [], '', false);
     $this->context->expects($this->any())->method('getEventDispatcher')->willReturn($this->eventManager);
     $this->object = $objectManager->getObject('\\Magento\\Sales\\Model\\Config\\Backend\\Grid\\AsyncIndexing', ['config' => $this->config, 'context' => $this->context]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:9,代码来源:AsyncIndexingTest.php

示例7: setUp

 /**
  * SetUp test
  */
 protected function setUp()
 {
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->resourceMock = $this->getMock('Magento\\Sales\\Model\\ResourceModel\\Order\\Status', [], [], '', false);
     $this->eventManagerMock = $this->getMock('Magento\\Framework\\Event\\Manager', [], [], '', false);
     $this->contextMock = $this->getMock('Magento\\Framework\\Model\\Context', [], [], '', false);
     $this->contextMock->expects($this->once())->method('getEventDispatcher')->will($this->returnValue($this->eventManagerMock));
     $this->model = $objectManager->getObject('Magento\\Sales\\Model\\Order\\Status', ['context' => $this->contextMock, 'resource' => $this->resourceMock, 'data' => ['status' => 'test_status']]);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:StatusTest.php

示例8: setUp

 protected function setUp()
 {
     $this->_contextMock = $this->getMock('\\Magento\\Framework\\Model\\Context', ['getEventDispatcher'], [], '', false);
     $eventManagerMock = $this->getMock('\\Magento\\Framework\\Event\\ManagerInterface');
     $this->_contextMock->expects($this->any())->method('getEventDispatcher')->willReturn($eventManagerMock);
     $this->_registryMock = $this->getMock('\\Magento\\Framework\\Registry', [], [], '', false);
     $this->_resourceMock = $this->getMock('\\Magento\\Indexer\\Model\\ResourceModel\\Mview\\View\\State', [], [], '', false);
     $this->_resourceCollectionMock = $this->getMock('\\Magento\\Indexer\\Model\\ResourceModel\\Mview\\View\\State\\Collection', [], [], '', false);
     $this->model = new \Magento\Indexer\Model\Mview\View\State($this->_contextMock, $this->_registryMock, $this->_resourceMock, $this->_resourceCollectionMock);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:10,代码来源:StateTest.php

示例9: __construct

 /**
  * @param \Magento\Payment\Model\CcConfig $ccConfig
  * @param PaymentHelper $paymentHelper
  * @param \Adyen\Payment\Helper\Data $adyenHelper
  */
 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Payment\Model\CcConfig $ccConfig, PaymentHelper $paymentHelper, \Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Model\Resource\Billing\Agreement\CollectionFactory $billingAgreementCollectionFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $session, \Magento\Store\Model\StoreManagerInterface $storeManager)
 {
     parent::__construct($ccConfig, $paymentHelper, $this->methodCodes);
     $this->_paymentHelper = $paymentHelper;
     $this->_adyenHelper = $adyenHelper;
     $this->_billingAgreementCollectionFactory = $billingAgreementCollectionFactory;
     $this->_customerSession = $customerSession;
     $this->_session = $session;
     $this->_appState = $context->getAppState();
     $this->_storeManager = $storeManager;
 }
开发者ID:pivulic,项目名称:adyen-magento2,代码行数:16,代码来源:AdyenOneclickConfigProvider.php

示例10: setUp

 protected function setUp()
 {
     $this->context = $this->getMockBuilder('Magento\\Framework\\Model\\Context')->disableOriginalConstructor()->getMock();
     $this->registry = $this->getMockBuilder('Magento\\Framework\\Registry')->disableOriginalConstructor()->getMock();
     $this->config = $this->getMockBuilder('Magento\\Framework\\App\\Config\\ScopeConfigInterface')->getMock();
     $this->design = $this->getMockBuilder('Magento\\Framework\\View\\DesignInterface')->getMock();
     $this->resource = $this->getMockBuilder('Magento\\Theme\\Model\\Resource\\Design')->disableOriginalConstructor()->getMock();
     $this->resourceCollection = $this->getMockBuilder('Magento\\Theme\\Model\\Resource\\Design\\Collection')->disableOriginalConstructor()->getMock();
     $this->context->expects($this->once())->method('getEventDispatcher')->willReturn($this->getMockBuilder('Magento\\Framework\\Event\\ManagerInterface')->getMock());
     $this->model = new Theme($this->context, $this->registry, $this->config, $this->design, $this->resource, $this->resourceCollection);
 }
开发者ID:nja78,项目名称:magento2,代码行数:11,代码来源:ThemeTest.php

示例11: setUp

 protected function setUp()
 {
     $this->contextMock = $this->getMock('Magento\\Framework\\Model\\Context', ['getEventDispatcher'], [], '', false);
     $eventManagerMock = $this->getMockForAbstractClass('Magento\\Framework\\Event\\ManagerInterface', [], '', false, true, true, ['dispatch']);
     $this->contextMock->expects($this->once())->method('getEventDispatcher')->will($this->returnValue($eventManagerMock));
     $this->registryMock = $this->getMock('Magento\\Framework\\Registry', [], [], '', false);
     $this->oauthDataMock = $this->getMock('Magento\\Integration\\Helper\\Oauth\\Data', [], [], '', false);
     $this->resourceMock = $this->getMockForAbstractClass('Magento\\Framework\\Model\\ResourceModel\\AbstractResource', [], '', false, true, true, ['getIdFieldName', 'selectByCompositeKey', 'deleteOldEntries']);
     $this->resourceCollectionMock = $this->getMock('Magento\\Framework\\Data\\Collection\\AbstractDb', [], [], '', false);
     $this->nonceModel = new \Magento\Integration\Model\Oauth\Nonce($this->contextMock, $this->registryMock, $this->oauthDataMock, $this->resourceMock, $this->resourceCollectionMock);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:11,代码来源:NonceTest.php

示例12: __construct

 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Module\Dir\Reader $configReader, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Store\Model\StoreManagerInterface $storeManager, \Mehulchaudhari\Geoip\Helper\Data $geoipHelper, array $data = [])
 {
     $this->_geoipHelper = $geoipHelper;
     $this->_logger = $context->getLogger();
     $this->_scopeConfig = $scopeConfig;
     $this->_storeManager = $storeManager;
     $this->libpath = $configReader->getModuleDir('', 'Mehulchaudhari_Geoip');
     if (!function_exists('geoip_country_code_by_name') && $this->_geoipHelper->getConfig('general/apache_or_file') == 1) {
         define('GEOIP_LOCAL', 1);
         $geoIpInc = $this->libpath . '/lib/geoip.inc';
         include $geoIpInc;
     }
 }
开发者ID:pierredewit,项目名称:MagentoExtensions,代码行数:13,代码来源:Geoip.php

示例13: __construct

 /**
  * @param \Magento\Framework\Model\Context $context
  * @param \Magento\Checkout\Model\Session $session
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param PaymentHelper $paymentHelper
  * @param \Adyen\Payment\Helper\Data $adyenHelper
  */
 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Checkout\Model\Session $session, \Magento\Store\Model\StoreManagerInterface $storeManager, PaymentHelper $paymentHelper, \Magento\Framework\Locale\ResolverInterface $localeResolver, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Logger\AdyenLogger $adyenLogger)
 {
     $this->_appState = $context->getAppState();
     $this->_session = $session;
     $this->_storeManager = $storeManager;
     $this->_paymentHelper = $paymentHelper;
     $this->_localeResolver = $localeResolver;
     $this->_config = $config;
     $this->_adyenHelper = $adyenHelper;
     $this->_adyenLogger = $adyenLogger;
     foreach ($this->methodCodes as $code) {
         $this->methods[$code] = $this->_paymentHelper->getMethodInstance($code);
     }
 }
开发者ID:pivulic,项目名称:adyen-magento2,代码行数:21,代码来源:AdyenHppConfigProvider.php

示例14: setUp

 public function setUp()
 {
     $this->contextMock = $this->getMock('Magento\\Framework\\Model\\Context', ['getEventDispatcher'], [], '', false);
     $eventManagerMock = $this->getMockForAbstractClass('Magento\\Framework\\Event\\ManagerInterface', [], '', false, true, true, ['dispatch']);
     $this->contextMock->expects($this->once())->method('getEventDispatcher')->will($this->returnValue($eventManagerMock));
     $this->registryMock = $this->getMock('Magento\\Framework\\Registry', [], [], '', false);
     $this->keyLengthValidator = new KeyLength();
     $this->urlValidator = new UrlValidator();
     $this->oauthDataMock = $this->getMock('Magento\\Integration\\Helper\\Oauth\\Data', ['getConsumerExpirationPeriod'], [], '', false);
     $this->oauthDataMock->expects($this->any())->method('getConsumerExpirationPeriod')->will($this->returnValue(\Magento\Integration\Helper\Oauth\Data::CONSUMER_EXPIRATION_PERIOD_DEFAULT));
     $this->resourceMock = $this->getMock('Magento\\Integration\\Model\\ResourceModel\\Oauth\\Consumer', ['getIdFieldName', 'selectByCompositeKey', 'deleteOldEntries'], [], '', false, true, true);
     $this->resourceCollectionMock = $this->getMock('Magento\\Framework\\Data\\Collection\\AbstractDb', [], [], '', false);
     $this->consumerModel = new \Magento\Integration\Model\Oauth\Consumer($this->contextMock, $this->registryMock, $this->keyLengthValidator, $this->urlValidator, $this->oauthDataMock, $this->resourceMock, $this->resourceCollectionMock);
     $this->validDataArray = ['key' => md5(uniqid()), 'secret' => md5(uniqid()), 'callback_url' => 'http://example.com/callback', 'rejected_callback_url' => 'http://example.com/rejectedCallback'];
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:ConsumerTest.php

示例15: setUp

 /**
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  * @return void
  */
 protected function setUp()
 {
     $this->contextMock = $this->getMockBuilder('Magento\\Framework\\Model\\Context')->disableOriginalConstructor()->getMock();
     $this->registryMock = $this->getMockBuilder('Magento\\Framework\\Registry')->getMock();
     $this->extensionAttributesFactory = $this->getMockBuilder('Magento\\Framework\\Api\\ExtensionAttributesFactory')->disableOriginalConstructor()->getMock();
     $this->attributeValueFactoryMock = $this->getMockBuilder('Magento\\Framework\\Api\\AttributeValueFactory')->disableOriginalConstructor()->getMock();
     $this->configMock = $this->getMockBuilder('Magento\\Eav\\Model\\Config')->disableOriginalConstructor()->getMock();
     $this->typeFactoryMock = $this->getMockBuilder('Magento\\Eav\\Model\\Entity\\TypeFactory')->disableOriginalConstructor()->getMock();
     $this->storeManagerMock = $this->getMockBuilder('Magento\\Store\\Model\\StoreManagerInterface')->getMock();
     $this->helperMock = $this->getMockBuilder('Magento\\Eav\\Model\\ResourceModel\\Helper')->disableOriginalConstructor()->getMock();
     $this->universalFactoryMock = $this->getMockBuilder('Magento\\Framework\\Validator\\UniversalFactory')->disableOriginalConstructor()->getMock();
     $this->attributeOptionFactoryMock = $this->getMockBuilder('Magento\\Eav\\Api\\Data\\AttributeOptionInterfaceFactory')->disableOriginalConstructor()->getMock();
     $this->dataObjectProcessorMock = $this->getMockBuilder('Magento\\Framework\\Reflection\\DataObjectProcessor')->disableOriginalConstructor()->getMock();
     $this->dataObjectHelperMock = $this->getMockBuilder('Magento\\Framework\\Api\\DataObjectHelper')->disableOriginalConstructor()->getMock();
     $this->timezoneMock = $this->getMockBuilder('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface')->getMock();
     $this->reservedAttributeListMock = $this->getMockBuilder('Magento\\Catalog\\Model\\Product\\ReservedAttributeList')->disableOriginalConstructor()->getMock();
     $this->resolverMock = $this->getMockBuilder('Magento\\Framework\\Locale\\ResolverInterface')->getMock();
     $this->dateTimeFormatter = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\DateTimeFormatterInterface');
     $this->resourceMock = $this->getMockBuilder('Magento\\Framework\\Model\\ResourceModel\\AbstractResource')->setMethods(['_construct', 'getConnection', 'getIdFieldName', 'saveInSetIncluding'])->getMockForAbstractClass();
     $this->cacheManager = $this->getMockBuilder('Magento\\Framework\\App\\CacheInterface')->getMock();
     $this->eventDispatcher = $this->getMockBuilder('Magento\\Framework\\Event\\ManagerInterface')->getMock();
     $this->contextMock->expects($this->any())->method('getCacheManager')->willReturn($this->cacheManager);
     $this->contextMock->expects($this->any())->method('getEventDispatcher')->willReturn($this->eventDispatcher);
     $this->indexerRegistryMock = $this->getMockBuilder('Magento\\Framework\\Indexer\\IndexerRegistry')->disableOriginalConstructor()->getMock();
     $this->attributeCacheMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\AttributeCache::class)->disableOriginalConstructor()->getMock();
     $objectManagerHelper = new ObjectManagerHelper($this);
     $this->attribute = $objectManagerHelper->getObject(Attribute::class, ['context' => $this->contextMock, 'registry' => $this->registryMock, 'extensionFactory' => $this->extensionAttributesFactory, 'attributeValueFactory' => $this->attributeValueFactoryMock, 'eavConfig' => $this->configMock, 'typeFactory' => $this->typeFactoryMock, 'storeManager' => $this->storeManagerMock, 'helper' => $this->helperMock, 'universalFactory' => $this->universalFactoryMock, 'attributeOptionFactory' => $this->attributeOptionFactoryMock, 'dataObjectProcessor' => $this->dataObjectProcessorMock, 'dataObjectHelper' => $this->dataObjectHelperMock, 'timezone' => $this->timezoneMock, 'reservedAttributeList' => $this->reservedAttributeListMock, 'resolver' => $this->resolverMock, 'dateTimeFormatter' => $this->dateTimeFormatter, 'indexerRegistry' => $this->indexerRegistryMock, 'resource' => $this->resourceMock, 'attributeCache' => $this->attributeCacheMock]);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:32,代码来源:AttributeTest.php


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