本文整理汇总了PHP中Magento\Framework\Model\Context::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::expects方法的具体用法?PHP Context::expects怎么用?PHP Context::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Model\Context
的用法示例。
在下文中一共展示了Context::expects方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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]);
}
示例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();
}
示例3: 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
);
}
示例4: 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]);
}
示例5: 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']]);
}
示例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]);
}
示例7: 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);
}
示例8: 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);
}
示例9: 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);
}
示例10: 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'];
}
示例11: 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]);
}
示例12: 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);
}
示例13: 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');
}
示例14: 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'])->disableOriginalConstructor()->getMockForAbstractClass();
$this->resourceMock->expects($this->any())->method('getIdFieldName')->willReturn('id');
$eventManagerMock = $this->getMockBuilder('Magento\\Framework\\Event\\ManagerInterface')->setMethods(['dispatch'])->disableOriginalConstructor()->getMock();
$this->contextMock->expects($this->once())->method('getEventDispatcher')->willReturn($eventManagerMock);
$this->tokenModel = new \Magento\Integration\Model\Oauth\Token($this->contextMock, $this->registryMock, $this->keyLengthFactoryMock, $this->validatorMock, $this->consumerFactoryMock, $this->oauthDataMock, $this->oauthHelperMock, $this->resourceMock);
}