コード例 #1
0
 protected function setUp()
 {
     parent::setUp();
     $this->eavConfigMock = $this->getMockBuilder(Config::class)->disableOriginalConstructor()->getMock();
     $this->eavValidationRulesMock = $this->getMockBuilder(EavValidationRules::class)->disableOriginalConstructor()->getMock();
     $this->requestMock = $this->getMockBuilder(RequestInterface::class)->getMockForAbstractClass();
     $this->groupCollectionFactoryMock = $this->getMockBuilder(GroupCollectionFactory::class)->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $this->groupCollectionMock = $this->getMockBuilder(GroupCollection::class)->disableOriginalConstructor()->getMock();
     $this->attributeMock = $this->getMockBuilder(EavAttribute::class)->disableOriginalConstructor()->getMock();
     $this->groupMock = $this->getMockBuilder(Group::class)->disableOriginalConstructor()->setMethods(['getAttributeGroupCode'])->getMock();
     $this->entityTypeMock = $this->getMockBuilder(EntityType::class)->disableOriginalConstructor()->getMock();
     $this->attributeCollectionMock = $this->getMockBuilder(AttributeCollection::class)->disableOriginalConstructor()->getMock();
     $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class)->getMockForAbstractClass();
     $this->formElementMapperMock = $this->getMockBuilder(FormElementMapper::class)->disableOriginalConstructor()->getMock();
     $this->metaPropertiesMapperMock = $this->getMockBuilder(MetaPropertiesMapper::class)->disableOriginalConstructor()->getMock();
     $this->groupCollectionFactoryMock->expects($this->any())->method('create')->willReturn($this->groupCollectionMock);
     $this->groupCollectionMock->expects($this->any())->method('setAttributeSetFilter')->willReturnSelf();
     $this->groupCollectionMock->expects($this->any())->method('setSortOrder')->willReturnSelf();
     $this->groupCollectionMock->expects($this->any())->method('load')->willReturnSelf();
     $this->groupCollectionMock->expects($this->any())->method('getIterator')->willReturn(new \ArrayIterator([$this->groupMock]));
     $this->attributeCollectionMock->expects($this->any())->method('addFieldToSelect')->willReturnSelf();
     $this->attributeCollectionMock->expects($this->any())->method('load')->willReturnSelf();
     $this->eavConfigMock->expects($this->any())->method('getEntityType')->willReturn($this->entityTypeMock);
     $this->entityTypeMock->expects($this->any())->method('getAttributeCollection')->willReturn($this->attributeCollectionMock);
     $this->productMock->expects($this->any())->method('getAttributes')->willReturn([$this->attributeMock]);
 }
コード例 #2
0
 protected function setUp()
 {
     parent::setUp();
     $this->urlBuilderMock = $this->getMockBuilder(UrlInterface::class)->getMockForAbstractClass();
     $this->registryMock = $this->getMockBuilder(Registry::class)->disableOriginalConstructor()->getMock();
     $this->authorizationMock = $this->getMockBuilder(AuthorizationInterface::class)->getMockForAbstractClass();
 }
コード例 #3
0
 protected function setUp()
 {
     parent::setUp();
     $this->stockRegistryMock = $this->getMockBuilder(StockRegistryInterface::class)->setMethods(['getStockItem'])->getMockForAbstractClass();
     $this->storeMock = $this->getMockBuilder(Store::class)->disableOriginalConstructor()->getMock();
     $this->stockItemMock = $this->getMockBuilder(StockItemInterface::class)->setMethods(['getData'])->getMockForAbstractClass();
     $this->stockRegistryMock->expects($this->any())->method('getStockItem')->willReturn($this->stockItemMock);
     $this->productMock->expects($this->any())->method('getStore')->willReturn($this->storeMock);
 }
コード例 #4
0
ファイル: WeeeTest.php プロジェクト: Doability/magento2dev
 protected function setUp()
 {
     parent::setUp();
     $this->sourceCountryMock = $this->getMockBuilder(SourceCountry::class)->disableOriginalConstructor()->getMock();
     $this->eavAttributeFactoryMock = $this->getMockBuilder(EavAttributeFactory::class)->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $this->eavAttributeMock = $this->getMockBuilder(EavAttribute::class)->disableOriginalConstructor()->getMock();
     $this->websiteManagerMock = $this->getMockBuilder(WebsiteManager::class)->disableOriginalConstructor()->getMock();
     $this->eavAttributeFactoryMock->expects($this->any())->method('create')->willReturn($this->eavAttributeMock);
     $this->eavAttributeMock->expects($this->any())->method('loadByCode')->willReturn($this->eavAttributeMock);
 }
コード例 #5
0
 protected function setUp()
 {
     parent::setUp();
     $this->productOptionsConfigMock = $this->getMockBuilder(ConfigInterface::class)->getMockForAbstractClass();
     $this->productOptionsPriceMock = $this->getMockBuilder(ProductOptionsPrice::class)->disableOriginalConstructor()->getMock();
     $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class)->getMockForAbstractClass();
     $this->storeMock = $this->getMockBuilder(StoreInterface::class)->setMethods(['getBaseCurrency'])->getMockForAbstractClass();
     $this->priceCurrency = $this->getMockBuilder(PriceCurrencyInterface::class)->disableOriginalConstructor()->getMock();
     $this->storeManagerMock->expects($this->any())->method('getStore')->willReturn($this->storeMock);
     $this->storeMock->expects($this->any())->method('getBaseCurrency')->willReturn($this->priceCurrency);
 }
コード例 #6
0
 protected function setUp()
 {
     parent::setUp();
     $this->attributeSetCollectionFactoryMock = $this->getMockBuilder(CollectionFactory::class)->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $this->attributeSetCollectionMock = $this->getMockBuilder(Collection::class)->disableOriginalConstructor()->getMock();
     $this->urlBuilderMock = $this->getMockBuilder(UrlInterface::class)->disableOriginalConstructor()->getMock();
     $this->productResourceMock = $this->getMockBuilder(ProductResource::class)->disableOriginalConstructor()->getMock();
     $this->attributeSetCollectionFactoryMock->expects($this->any())->method('create')->willReturn($this->attributeSetCollectionMock);
     $this->productMock->expects($this->any())->method('getResource')->willReturn($this->productResourceMock);
     $this->attributeSetCollectionMock->expects($this->any())->method('setEntityTypeFilter')->willReturnSelf();
     $this->attributeSetCollectionMock->expects($this->any())->method('addFieldToSelect')->willReturnSelf();
 }
コード例 #7
0
 protected function setUp()
 {
     parent::setUp();
     $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class)->getMockForAbstractClass();
     $this->groupRepositoryMock = $this->getMockBuilder(GroupRepositoryInterface::class)->getMockForAbstractClass();
     $this->groupManagementMock = $this->getMockBuilder(GroupManagementInterface::class)->getMockForAbstractClass();
     $this->searchCriteriaBuilderMock = $this->getMockBuilder(SearchCriteriaBuilder::class)->disableOriginalConstructor()->getMock();
     $this->moduleManagerMock = $this->getMockBuilder(ModuleManager::class)->disableOriginalConstructor()->getMock();
     $this->directoryHelperMock = $this->getMockBuilder(DirectoryHelper::class)->disableOriginalConstructor()->getMock();
     $this->productResourceMock = $this->getMockBuilder(ProductResource::class)->disableOriginalConstructor()->getMock();
     $this->attributeMock = $this->getMockBuilder(Attribute::class)->disableOriginalConstructor()->getMock();
     $this->customerGroupMock = $this->getMockBuilder(CustomerGroupInterface::class)->getMockForAbstractClass();
     $this->groupManagementMock->expects($this->any())->method('getAllCustomersGroup')->willReturn($this->customerGroupMock);
 }
コード例 #8
0
 protected function setUp()
 {
     parent::setUp();
     $this->categoryCollectionFactoryMock = $this->getMockBuilder(CategoryCollectionFactory::class)->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $this->dbHelperMock = $this->getMockBuilder(DbHelper::class)->disableOriginalConstructor()->getMock();
     $this->urlBuilderMock = $this->getMockBuilder(UrlInterface::class)->getMockForAbstractClass();
     $this->storeMock = $this->getMockBuilder(Store::class)->disableOriginalConstructor()->getMock();
     $this->categoryCollectionMock = $this->getMockBuilder(CategoryCollection::class)->disableOriginalConstructor()->getMock();
     $this->categoryCollectionFactoryMock->expects($this->any())->method('create')->willReturn($this->categoryCollectionMock);
     $this->categoryCollectionMock->expects($this->any())->method('addAttributeToSelect')->willReturnSelf();
     $this->categoryCollectionMock->expects($this->any())->method('addAttributeToFilter')->willReturnSelf();
     $this->categoryCollectionMock->expects($this->any())->method('setStoreId')->willReturnSelf();
     $this->categoryCollectionMock->expects($this->any())->method('getIterator')->willReturn(new \ArrayIterator([]));
 }
コード例 #9
0
ファイル: EavTest.php プロジェクト: Doability/magento2dev
 protected function setUp()
 {
     parent::setUp();
     $this->objectManager = new ObjectManager($this);
     $this->eavConfigMock = $this->getMockBuilder(Config::class)->disableOriginalConstructor()->getMock();
     $this->eavValidationRulesMock = $this->getMockBuilder(EavValidationRules::class)->disableOriginalConstructor()->getMock();
     $this->requestMock = $this->getMockBuilder(RequestInterface::class)->getMockForAbstractClass();
     $this->groupCollectionFactoryMock = $this->getMockBuilder(GroupCollectionFactory::class)->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $this->groupCollectionMock = $this->getMockBuilder(GroupCollection::class)->disableOriginalConstructor()->getMock();
     $this->attributeMock = $this->getMockBuilder(EavAttribute::class)->disableOriginalConstructor()->getMock();
     $this->groupMock = $this->getMockBuilder(Group::class)->disableOriginalConstructor()->setMethods(['getAttributeGroupCode'])->getMock();
     $this->entityTypeMock = $this->getMockBuilder(EntityType::class)->disableOriginalConstructor()->getMock();
     $this->attributeCollectionMock = $this->getMockBuilder(AttributeCollection::class)->disableOriginalConstructor()->getMock();
     $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class)->getMockForAbstractClass();
     $this->formElementMapperMock = $this->getMockBuilder(FormElementMapper::class)->disableOriginalConstructor()->getMock();
     $this->metaPropertiesMapperMock = $this->getMockBuilder(MetaPropertiesMapper::class)->disableOriginalConstructor()->getMock();
     $this->searchCriteriaBuilderMock = $this->getMockBuilder(SearchCriteriaBuilder::class)->disableOriginalConstructor()->getMock();
     $this->attributeGroupRepositoryMock = $this->getMockBuilder(ProductAttributeGroupRepositoryInterface::class)->getMockForAbstractClass();
     $this->attributeGroupMock = $this->getMockBuilder(AttributeGroupInterface::class)->setMethods(['getAttributeGroupCode', 'getApplyTo'])->getMockForAbstractClass();
     $this->attributeRepositoryMock = $this->getMockBuilder(ProductAttributeRepositoryInterface::class)->getMockForAbstractClass();
     $this->searchCriteriaMock = $this->getMockBuilder(SearchCriteria::class)->disableOriginalConstructor()->setMethods(['getItems'])->getMock();
     $this->sortOrderBuilderMock = $this->getMockBuilder(SortOrderBuilder::class)->disableOriginalConstructor()->getMock();
     $this->searchResultsMock = $this->getMockBuilder(SearchResultsInterface::class)->getMockForAbstractClass();
     $this->eavAttributeMock = $this->getMockBuilder(Attribute::class)->setMethods(['getAttributeGroupCode', 'getApplyTo', 'getFrontendInput', 'getAttributeCode'])->disableOriginalConstructor()->getMock();
     $this->groupCollectionFactoryMock->expects($this->any())->method('create')->willReturn($this->groupCollectionMock);
     $this->groupCollectionMock->expects($this->any())->method('setAttributeSetFilter')->willReturnSelf();
     $this->groupCollectionMock->expects($this->any())->method('setSortOrder')->willReturnSelf();
     $this->groupCollectionMock->expects($this->any())->method('load')->willReturnSelf();
     $this->groupCollectionMock->expects($this->any())->method('getIterator')->willReturn(new \ArrayIterator([$this->groupMock]));
     $this->attributeCollectionMock->expects($this->any())->method('addFieldToSelect')->willReturnSelf();
     $this->attributeCollectionMock->expects($this->any())->method('load')->willReturnSelf();
     $this->eavConfigMock->expects($this->any())->method('getEntityType')->willReturn($this->entityTypeMock);
     $this->entityTypeMock->expects($this->any())->method('getAttributeCollection')->willReturn($this->attributeCollectionMock);
     $this->productMock->expects($this->any())->method('getAttributes')->willReturn([$this->attributeMock]);
     $this->storeMock = $this->getMockBuilder(StoreInterface::class)->setMethods(['load', 'getId', 'getConfig', 'getBaseCurrencyCode'])->getMockForAbstractClass();
     $this->currencyMock = $this->getMockBuilder(Currency::class)->disableOriginalConstructor()->setMethods(['toCurrency'])->getMock();
     $this->currencyLocaleMock = $this->getMockBuilder(CurrencyLocale::class)->disableOriginalConstructor()->setMethods(['getCurrency'])->getMock();
     $this->eav = $this->getModel();
     $this->objectManager->setBackwardCompatibleProperty($this->eav, 'localeCurrency', $this->currencyLocaleMock);
 }
コード例 #10
0
 protected function setUp()
 {
     parent::setUp();
     $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class)->getMockForAbstractClass();
 }
コード例 #11
0
 protected function setUp()
 {
     $this->msrpConfigMock = $this->getMockBuilder(MsrpConfig::class)->disableOriginalConstructor()->getMock();
     parent::setUp();
 }
コード例 #12
0
 protected function setUp()
 {
     parent::setUp();
     $this->urlBuilderMock = $this->getMockBuilder(UrlInterface::class)->getMockForAbstractClass();
 }