本文整理汇总了PHP中Magento\Framework\Model\Context类的典型用法代码示例。如果您正苦于以下问题:PHP Context类的具体用法?PHP Context怎么用?PHP Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Context类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: __construct
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Model\Context $contextModel
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
* @param \Wyomind\Core\Helper\Data $coreHelper
* @param \Wyomind\SimpleGoogleShopping\Helper\Data $sgsHelper
* @param \Wyomind\SimpleGoogleShopping\Model\Feeds $sgsModel
* @param \Magento\Framework\Model\Context $context_
* @param \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory
* @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
* @param \Magento\Framework\Filesystem\Directory\ReadFactory $directoryRead
* @param \Wyomind\SimpleGoogleShopping\Helper\Parser $parserHelper
* @param \Magento\Eav\Api\AttributeRepositoryInterface $attributeRepository
*/
public function __construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\Model\Context $contextModel, \Magento\Framework\Registry $coreRegistry, \Magento\Framework\View\Result\PageFactory $resultPageFactory, \Wyomind\Core\Helper\Data $coreHelper, \Wyomind\SimpleGoogleShopping\Helper\Data $sgsHelper, \Wyomind\SimpleGoogleShopping\Model\Feeds $sgsModel, \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory, \Magento\Framework\Controller\Result\RawFactory $resultRawFactory, \Magento\Framework\Filesystem\Directory\ReadFactory $directoryRead, \Wyomind\SimpleGoogleShopping\Helper\Parser $parserHelper, \Magento\Eav\Api\AttributeRepositoryInterface $attributeRepository)
{
$this->coreRegistry = $coreRegistry;
$this->resultPageFactory = $resultPageFactory;
$this->coreHelper = $coreHelper;
$this->cacheManager = $contextModel->getCacheManager();
$this->sgsHelper = $sgsHelper;
$this->sgsModel = $sgsModel;
$this->resultForwardFactory = $resultForwardFactory;
$this->resultRedirectFactory = $context->getResultRedirectFactory();
$this->resultRawFactory = $resultRawFactory;
$this->parserHelper = $parserHelper;
$this->attributeRepository = $attributeRepository;
$this->directoryRead = $directoryRead->create("app/code/Wyomind/SimpleGoogleShopping");
parent::__construct($context);
}
开发者ID:Doability,项目名称:magento2dev,代码行数:31,代码来源:Feeds.php
示例17: setUp
protected function setUp()
{
$this->contextMock = $this->getMockBuilder('Magento\\Framework\\Model\\Context')->setMethods(['getCacheManager', 'getEventDispatcher'])->disableOriginalConstructor()->getMock();
$this->registryMock = $this->getMockBuilder('Magento\\Framework\\Registry')->getMock();
$this->metadataServiceMock = $this->getMockBuilder('Magento\\Framework\\Api\\MetadataServiceInterface')->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')->setMethods(['create'])->disableOriginalConstructor()->getMock();
$this->storeManagerMock = $this->getMockBuilder('Magento\\Store\\Model\\StoreManagerInterface')->getMock();
$this->helperMock = $this->getMockBuilder('Magento\\Eav\\Model\\Resource\\Helper')->disableOriginalConstructor()->getMock();
$this->universalFactoryMock = $this->getMockBuilder('Magento\\Framework\\Validator\\UniversalFactory')->disableOriginalConstructor()->getMock();
$this->attributeOptionFactoryMock = $this->getMockBuilder('Magento\\Eav\\Api\\Data\\AttributeOptionInterfaceFactory')->setMethods(['create'])->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->lockValidatorMock = $this->getMockBuilder('Magento\\Catalog\\Model\\Attribute\\LockValidatorInterface')->getMock();
$this->resourceMock = $this->getMockBuilder('Magento\\Framework\\Model\\Resource\\AbstractResource')->setMethods(['_construct', '_getReadAdapter', '_getWriteAdapter', '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->attribute = new Attribute($this->contextMock, $this->registryMock, $this->extensionAttributesFactory, $this->attributeValueFactoryMock, $this->configMock, $this->typeFactoryMock, $this->storeManagerMock, $this->helperMock, $this->universalFactoryMock, $this->attributeOptionFactoryMock, $this->dataObjectProcessorMock, $this->dataObjectHelperMock, $this->timezoneMock, $this->reservedAttributeListMock, $this->resolverMock, $this->lockValidatorMock, $this->resourceMock);
}
开发者ID:Coplex,项目名称:magento2,代码行数:26,代码来源:AttributeTest.php
示例18: setUp
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
protected function setUp()
{
$this->contextMock = $this->getMockBuilder('\\Magento\\Framework\\Model\\Context')->disableOriginalConstructor()->getMock();
$this->configMock = $this->getMockBuilder('\\Magento\\Braintree\\Model\\Config\\Cc')->disableOriginalConstructor()->getMock();
$this->vaultMock = $this->getMockBuilder('\\Magento\\Braintree\\Model\\Vault')->disableOriginalConstructor()->getMock();
$this->registryMock = $this->getMockBuilder('\\Magento\\Framework\\Registry')->disableOriginalConstructor()->getMock();
$this->salesTransactionCollectionFactoryMock = $this->getMockBuilder('\\Magento\\Sales\\Model\\ResourceModel\\Order\\Payment\\Transaction\\CollectionFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$this->productMetaDataMock = $this->getMockBuilder('\\Magento\\Framework\\App\\ProductMetadataInterface')->disableOriginalConstructor()->getMock();
$this->helperMock = $this->getMockBuilder('\\Magento\\Braintree\\Helper\\Data')->disableOriginalConstructor()->getMock();
$this->errorHelperMock = $this->getMockBuilder('\\Magento\\Braintree\\Helper\\Error')->disableOriginalConstructor()->getMock();
$this->regionFactoryMock = $this->getMockBuilder('\\Magento\\Directory\\Model\\RegionFactory')->disableOriginalConstructor()->getMock();
$this->loggerMock = $this->getMockBuilder('\\Magento\\Payment\\Model\\Method\\Logger')->disableOriginalConstructor()->getMock();
$this->braintreeTransactionMock = $this->getMockBuilder('\\Magento\\Braintree\\Model\\Adapter\\BraintreeTransaction')->getMock();
$this->braintreeCreditCardMock = $this->getMockBuilder('\\Magento\\Braintree\\Model\\Adapter\\BraintreeCreditCard')->getMock();
$this->appStateMock = $this->getMockBuilder('\\Magento\\Framework\\App\\State')->disableOriginalConstructor()->getMock();
$this->psrLoggerMock = $this->getMock('\\Psr\\Log\\LoggerInterface');
$this->contextMock->expects($this->any())->method('getLogger')->willReturn($this->psrLoggerMock);
$this->contextMock->expects($this->any())->method('getAppState')->willReturn($this->appStateMock);
$this->orderRepository = $this->getMockBuilder('Magento\\Sales\\Api\\OrderRepositoryInterface')->getMockForAbstractClass();
$this->objectManagerHelper = new ObjectManagerHelper($this);
$this->model = $this->objectManagerHelper->getObject('Magento\\Braintree\\Model\\PaymentMethod', ['context' => $this->contextMock, 'config' => $this->configMock, 'vault' => $this->vaultMock, 'registry' => $this->registryMock, 'salesTransactionCollectionFactory' => $this->salesTransactionCollectionFactoryMock, 'productMetaData' => $this->productMetaDataMock, 'braintreeHelper' => $this->helperMock, 'errorHelper' => $this->errorHelperMock, 'regionFactory' => $this->regionFactoryMock, 'logger' => $this->loggerMock, 'braintreeTransaction' => $this->braintreeTransactionMock, 'braintreeCreditCard' => $this->braintreeCreditCardMock, 'orderRepository' => $this->orderRepository]);
$this->infoInstanceMock = $this->getMockForAbstractClass('\\Magento\\Payment\\Model\\InfoInterface', [], '', false, false, false, ['setCcType', 'setCcOwner', 'setCcLast4', 'setCcNumber', 'setCcCid', 'setCcExpMonth', 'setCcExpYear', 'setCcSsIssue', 'setCcSsStartMonth', 'setCcSsStartYear', 'getOrder', 'getQuote', 'getCcType']);
$this->productMetaDataMock->expects($this->any())->method('getEdition')->willReturn('Community Edition');
$this->productMetaDataMock->expects($this->any())->method('getVersion')->willReturn('2.0');
}
开发者ID:whoople,项目名称:magento2-testing,代码行数:28,代码来源:PaymentMethodTest.php
示例19: setUp
protected function setUp()
{
$this->contextMock = $this->getMockBuilder('Magento\\Framework\\Model\\Context')->setMethods(['getEventDispatcher'])->disableOriginalConstructor()->getMock();
$this->registryMock = $this->getMockBuilder('Magento\\Framework\\Registry')->disableOriginalConstructor()->getMock();
$this->validatorKeyLengthMock = $this->getMockBuilder('Magento\\Integration\\Model\\Oauth\\Consumer\\Validator\\KeyLength')->setMethods(['isValid', 'setLength', 'setName', 'getMessages'])->disableOriginalConstructor()->getMock();
$this->keyLengthFactoryMock = $this->getMockBuilder('Magento\\Integration\\Model\\Oauth\\Consumer\\Validator\\KeyLengthFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
$this->validatorMock = $this->getMockBuilder('Magento\\Framework\\Url\\Validator')->disableOriginalConstructor()->getMock();
$this->consumerFactoryMock = $this->getMockBuilder('Magento\\Integration\\Model\\Oauth\\ConsumerFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
$this->oauthDataMock = $this->getMockBuilder('Magento\\Integration\\Helper\\Oauth\\Data')->setMethods(['isCleanupProbability', 'getCleanupExpirationPeriod'])->disableOriginalConstructor()->getMock();
$this->oauthHelperMock = $this->getMockBuilder('Magento\\Framework\\Oauth\\Helper\\Oauth')->disableOriginalConstructor()->getMock();
$this->resourceMock = $this->getMockBuilder('Magento\\Framework\\Model\\ResourceModel\\AbstractResource')->setMethods(['getIdFieldName', 'deleteOldEntries', '_construct', 'getConnection', 'selectTokenByType', 'save', 'selectTokenByConsumerIdAndUserType', 'selectTokenByAdminId', 'selectTokenByCustomerId', 'load'])->disableOrigina
|
请发表评论