protected function setUp() { $this->objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->categoryRepositoryMock = $this->getMock('Magento\\Catalog\\Api\\CategoryRepositoryInterface'); $this->categoryTreeMock = $this->getMock('Magento\\Catalog\\Model\\Category\\Tree', [], [], '', false); $this->categoriesFactoryMock = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Category\\CollectionFactory', ['create', 'addFilter', 'getFirstItem'], [], '', false); $this->model = $this->objectManagerHelper->getObject('\\Magento\\Catalog\\Model\\CategoryManagement', ['categoryRepository' => $this->categoryRepositoryMock, 'categoryTree' => $this->categoryTreeMock, 'categoriesFactory' => $this->categoriesFactoryMock]); $this->scopeResolverMock = $this->getMock('\\Magento\\Framework\\App\\ScopeResolverInterface'); $this->scopeMock = $this->getMock('Magento\\Framework\\App\\ScopeInterface'); $this->objectManagerHelper->setBackwardCompatibleProperty($this->model, 'scopeResolver', $this->scopeResolverMock); }
protected function setUp() { $this->objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->helperMock = $this->getMock('Magento\\Captcha\\Helper\\Data', [], [], '', false); $this->actionFlagMock = $this->getMock('Magento\\Framework\\App\\ActionFlag', [], [], '', false); $this->messageManagerMock = $this->getMock('\\Magento\\Framework\\Message\\ManagerInterface', [], [], '', false); $this->redirectMock = $this->getMock('\\Magento\\Framework\\App\\Response\\RedirectInterface', [], [], '', false); $this->captchaStringResolverMock = $this->getMock('\\Magento\\Captcha\\Observer\\CaptchaStringResolver', [], [], '', false); $this->sessionMock = $this->getMock('Magento\\Framework\\Session\\SessionManager', [], [], '', false); $this->dataPersistorMock = $this->getMockBuilder('Magento\\Framework\\App\\Request\\DataPersistorInterface')->getMockForAbstractClass(); $this->checkContactUsFormObserver = $this->objectManagerHelper->getObject('Magento\\Captcha\\Observer\\CheckContactUsFormObserver', ['helper' => $this->helperMock, 'actionFlag' => $this->actionFlagMock, 'messageManager' => $this->messageManagerMock, 'redirect' => $this->redirectMock, 'captchaStringResolver' => $this->captchaStringResolverMock]); $this->objectManagerHelper->setBackwardCompatibleProperty($this->checkContactUsFormObserver, 'dataPersistor', $this->dataPersistorMock); $this->captchaMock = $this->getMock('Magento\\Captcha\\Model\\DefaultModel', [], [], '', false); }
protected function setUp() { $this->objectManager = new ObjectManagerHelper($this); $this->backendConfigMock = $this->getMockBuilder(ConfigInterface::class)->disableOriginalConstructor()->setMethods(['getValue'])->getMockForAbstractClass(); $this->customerRegistryMock = $this->getMock(CustomerRegistry::class, ['retrieveSecureData', 'retrieve'], [], '', false); $this->customerRepositoryMock = $this->getMockBuilder(CustomerRepositoryInterface::class)->disableOriginalConstructor()->getMock(); $this->encryptorMock = $this->getMockBuilder(\Magento\Framework\Encryption\EncryptorInterface::class)->disableOriginalConstructor()->getMock(); $this->dateTimeMock = $this->getMockBuilder(DateTime::class)->disableOriginalConstructor()->getMock(); $this->dateTimeMock->expects($this->any())->method('formatDate')->willReturn('formattedDate'); $this->customerSecureMock = $this->getMock(CustomerSecure::class, ['getId', 'getPasswordHash', 'isCustomerLocked', 'getFailuresNum', 'getFirstFailure', 'getLockExpires', 'setFirstFailure', 'setFailuresNum', 'setLockExpires'], [], '', false); $this->customerAuthUpdate = $this->getMockBuilder(\Magento\Customer\Model\CustomerAuthUpdate::class)->disableOriginalConstructor()->getMock(); $this->authentication = $this->objectManager->getObject(Authentication::class, ['customerRegistry' => $this->customerRegistryMock, 'backendConfig' => $this->backendConfigMock, 'customerRepository' => $this->customerRepositoryMock, 'encryptor' => $this->encryptorMock, 'dateTime' => $this->dateTimeMock]); $this->objectManager->setBackwardCompatibleProperty($this->authentication, 'customerAuthUpdate', $this->customerAuthUpdate); }
public function testGetPostValue() { $postData = ['name' => 'Some Name', 'email' => 'Some Email']; $dataPersistorMock = $this->getMockBuilder('Magento\\Framework\\App\\Request\\DataPersistorInterface')->getMockForAbstractClass(); $dataPersistorMock->expects($this->once())->method('get')->with('contact_us')->willReturn($postData); $dataPersistorMock->expects($this->once())->method('clear')->with('contact_us'); $this->objectManagerHelper->setBackwardCompatibleProperty($this->helper, 'dataPersistor', $dataPersistorMock); $this->assertSame($postData['name'], $this->helper->getPostValue('name')); $this->assertSame($postData['email'], $this->helper->getPostValue('email')); }
protected function setUp() { $this->paymentDataHelper = $this->getMockBuilder(Data::class)->disableOriginalConstructor()->setMethods(['getStoreMethods'])->getMock(); $this->vaultPayment = $this->getMockForAbstractClass(VaultPaymentInterface::class); $this->storeManager = $this->getMockForAbstractClass(StoreManagerInterface::class); $this->store = $this->getMockForAbstractClass(StoreInterface::class); $this->session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); $objectManager = new ObjectManager($this); $this->vaultConfigProvider = new VaultConfigProvider($this->storeManager, $this->session); $objectManager->setBackwardCompatibleProperty($this->vaultConfigProvider, 'paymentDataHelper', $this->paymentDataHelper); }
protected function setUp() { $this->initCcTypeMock(); $this->initSessionQuoteMock(); $this->initGatewayConfigMock(); $this->storeManager = $this->getMockForAbstractClass(StoreManagerInterface::class); $this->paymentDataHelper = $this->getMockBuilder(Data::class)->disableOriginalConstructor()->setMethods(['getMethodInstance'])->getMock(); $managerHelper = new ObjectManager($this); $this->block = $managerHelper->getObject(Form::class, ['paymentConfig' => $managerHelper->getObject(Config::class), 'sessionQuote' => $this->sessionQuote, 'gatewayConfig' => $this->gatewayConfig, 'ccType' => $this->ccType, 'storeManager' => $this->storeManager]); $managerHelper->setBackwardCompatibleProperty($this->block, 'paymentDataHelper', $this->paymentDataHelper); }
/** * @dataProvider isSecureDataProvider * * @param bool $isSecure expected output of isSecure method * @param string $serverHttps value of $_SERVER['HTTPS'] * @param string $headerOffloadKey <Name-Of-Offload-Header> * @param string $headerOffloadValue value of $_SERVER[<Name-Of-Offload-Header>] * @param int $configCall number of times config->getValue is expected to be called */ public function testIsSecure($isSecure, $serverHttps, $headerOffloadKey, $headerOffloadValue, $configCall) { $this->_model = $this->getModel(null, false); $configOffloadHeader = 'Header-From-Proxy'; $configMock = $this->getMockBuilder('Magento\\Framework\\App\\Config')->disableOriginalConstructor()->setMethods(['getValue'])->getMock(); $configMock->expects($this->exactly($configCall))->method('getValue')->with(\Magento\Framework\App\Request\Http::XML_PATH_OFFLOADER_HEADER, ScopeConfigInterface::SCOPE_TYPE_DEFAULT)->willReturn($configOffloadHeader); $this->objectManager->setBackwardCompatibleProperty($this->_model, 'appConfig', $configMock); $this->objectManager->setBackwardCompatibleProperty($this->_model, 'sslOffloadHeader', null); $this->_model->getServer()->set($headerOffloadKey, $headerOffloadValue); $this->_model->getServer()->set('HTTPS', $serverHttps); $this->assertSame($isSecure, $this->_model->isSecure()); }
public function testGetConfig() { $storeId = 1; $vaultProviderCode = 'vault_provider_code'; $expectedConfig = ['payment' => ['vault' => [$vaultProviderCode . '_item_' . '0' => ['config' => ['token_code' => 'code'], 'component' => 'Vendor_Module/js/vault_component']]]]; $token = $this->getMockForAbstractClass(PaymentTokenInterface::class); $tokenUiComponentProvider = $this->getMockForAbstractClass(TokenUiComponentProviderInterface::class); $tokenUiComponent = $this->getMockForAbstractClass(TokenUiComponentInterface::class); $this->storeManager->expects(static::once())->method('getStore')->willReturn($this->store); $this->store->expects(static::once())->method('getId')->willReturn($storeId); $this->paymentDataHelper->expects(static::once())->method('getStoreMethods')->with($storeId)->willReturn([$this->vaultPayment]); $this->vaultPayment->expects(static::once())->method('isActive')->with($storeId)->willReturn(true); $this->vaultPayment->expects(static::once())->method('getProviderCode')->willReturn($vaultProviderCode); $this->customerTokenManagement->expects(static::once())->method('getCustomerSessionTokens')->willReturn([$token]); $token->expects(static::once())->method('getPaymentMethodCode')->willReturn($vaultProviderCode); $tokenUiComponentProvider->expects(static::once())->method('getComponentForToken')->with($token)->willReturn($tokenUiComponent); $tokenUiComponent->expects(static::once())->method('getConfig')->willReturn(['token_code' => 'code']); $tokenUiComponent->expects(static::once())->method('getName')->willReturn('Vendor_Module/js/vault_component'); $configProvider = new TokensConfigProvider($this->storeManager, $this->customerTokenManagement, [$vaultProviderCode => $tokenUiComponentProvider]); $this->objectManager->setBackwardCompatibleProperty($configProvider, 'paymentDataHelper', $this->paymentDataHelper); static::assertEquals($expectedConfig, $configProvider->getConfig()); }
/** * @covers \Magento\Vault\Model\Ui\Adminhtml\TokensConfigProvider::getTokensComponents */ public function testGetTokensComponentsEmptyComponentProvider() { $storeId = 1; $customerId = 2; $vaultPaymentCode = 'vault_payment'; $this->session->expects(static::once())->method('getCustomerId')->willReturn($customerId); $this->initStoreMock(); $this->paymentDataHelper->expects(static::once())->method('getMethodInstance')->with($vaultPaymentCode)->willReturn($this->vaultPayment); $this->vaultPayment->expects(static::once())->method('isActive')->with($storeId)->willReturn(false); $this->paymentTokenRepository->expects(static::never())->method('getList'); $configProvider = new TokensConfigProvider($this->session, $this->paymentTokenRepository, $this->filterBuilder, $this->searchCriteriaBuilder, $this->storeManager, $this->dateTimeFactory); $this->objectManager->setBackwardCompatibleProperty($configProvider, 'paymentDataHelper', $this->paymentDataHelper); static::assertEmpty($configProvider->getTokensComponents($vaultPaymentCode)); }
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); }
/** * @return void */ protected function setUp() { $objectManager = new ObjectManager($this); $this->requestMock = $this->getMockBuilder('Magento\\Framework\\App\\Request\\Http')->disableOriginalConstructor()->setMethods([])->getMock(); $this->responseMock = $this->getMockBuilder('Magento\\Framework\\App\\Response\\Http')->disableOriginalConstructor()->setMethods([])->getMock(); $this->objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManagerInterface'); $this->messageManagerMock = $this->getMockBuilder('Magento\\Framework\\Message\\Manager')->disableOriginalConstructor()->setMethods([])->getMock(); $this->sessionMock = $this->getMockBuilder('Magento\\Backend\\Model\\Session')->disableOriginalConstructor()->setMethods([])->getMock(); $this->actionFlagMock = $this->getMockBuilder('Magento\\Framework\\App\\ActionFlag')->disableOriginalConstructor()->setMethods([])->getMock(); $this->helperMock = $this->getMockBuilder('Magento\\Backend\\Helper\\Data')->disableOriginalConstructor()->setMethods([])->getMock(); $this->resultRedirectFactoryMock = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\RedirectFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock(); $this->resultForwardFactoryMock = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\ForwardFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock(); $contextMock = $this->getMockBuilder('Magento\\Backend\\App\\Action\\Context')->disableOriginalConstructor()->setMethods([])->getMock(); $contextMock->expects($this->any())->method('getRequest')->willReturn($this->requestMock); $contextMock->expects($this->any())->method('getResponse')->willReturn($this->responseMock); $contextMock->expects($this->any())->method('getObjectManager')->willReturn($this->objectManagerMock); $contextMock->expects($this->any())->method('getMessageManager')->willReturn($this->messageManagerMock); $contextMock->expects($this->any())->method('getSession')->willReturn($this->sessionMock); $contextMock->expects($this->any())->method('getActionFlag')->willReturn($this->actionFlagMock); $contextMock->expects($this->any())->method('getHelper')->willReturn($this->helperMock); $contextMock->expects($this->any())->method('getResultRedirectFactory')->willReturn($this->resultRedirectFactoryMock); $this->invoiceRepository = $this->getMockBuilder(InvoiceRepositoryInterface::class)->disableOriginalConstructor()->getMockForAbstractClass(); $this->controller = $objectManager->getObject('Magento\\Sales\\Controller\\Adminhtml\\Order\\Invoice\\Cancel', ['context' => $contextMock, 'resultForwardFactory' => $this->resultForwardFactoryMock]); $objectManager->setBackwardCompatibleProperty($this->controller, 'invoiceRepository', $this->invoiceRepository); }
public function testGetBuildNotationCode() { $productMetadata = $this->getMock(ProductMetadataInterface::class, [], [], '', false); $productMetadata->expects($this->once())->method('getEdition')->will($this->returnValue('SomeEdition')); $objectManagerHelper = new ObjectManagerHelper($this); $objectManagerHelper->setBackwardCompatibleProperty($this->config, 'productMetadata', $productMetadata); $this->assertEquals('Magento_Cart_SomeEdition', $this->config->getBuildNotationCode()); }
protected function setUp() { $objectManager = new ObjectManager($this); $this->requestMock = $this->getMockBuilder('Magento\\Framework\\App\\Request\\Http')->disableOriginalConstructor()->setMethods([])->getMock(); $this->responseMock = $this->getMockBuilder('Magento\\Framework\\App\\Response\\Http')->disableOriginalConstructor()->setMethods([])->getMock(); $this->titleMock = $this->getMockBuilder('Magento\\Framework\\App\\Action\\Title')->disableOriginalConstructor()->setMethods([])->getMock(); $this->viewMock = $this->getMockBuilder('Magento\\Framework\\App\\View')->disableOriginalConstructor()->setMethods([])->getMock(); $this->actionFlagMock = $this->getMockBuilder('Magento\\Framework\\App\\ActionFlag')->disableOriginalConstructor()->setMethods([])->getMock(); $this->sessionMock = $this->getMockBuilder('Magento\\Backend\\Model\\Session')->disableOriginalConstructor()->setMethods(['getCommentText', 'setIsUrlNotice'])->getMock(); $this->resultPageMock = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Page')->disableOriginalConstructor()->getMock(); $this->pageConfigMock = $this->getMockBuilder('Magento\\Framework\\View\\Page\\Config')->disableOriginalConstructor()->getMock(); $this->pageTitleMock = $this->getMockBuilder('Magento\\Framework\\View\\Page\\Title')->disableOriginalConstructor()->getMock(); $contextMock = $this->getMockBuilder('Magento\\Backend\\App\\Action\\Context')->disableOriginalConstructor()->setMethods([])->getMock(); $contextMock->expects($this->any())->method('getRequest')->will($this->returnValue($this->requestMock)); $contextMock->expects($this->any())->method('getResponse')->will($this->returnValue($this->responseMock)); $contextMock->expects($this->any())->method('getTitle')->will($this->returnValue($this->titleMock)); $contextMock->expects($this->any())->method('getView')->will($this->returnValue($this->viewMock)); $contextMock->expects($this->any())->method('getActionFlag')->will($this->returnValue($this->actionFlagMock)); $contextMock->expects($this->any())->method('getSession')->will($this->returnValue($this->sessionMock)); $this->viewMock->expects($this->any())->method('getPage')->willReturn($this->resultPageMock); $this->resultPageMock->expects($this->any())->method('getConfig')->willReturn($this->pageConfigMock); $this->pageConfigMock->expects($this->any())->method('getTitle')->willReturn($this->pageTitleMock); $this->resultPageFactoryMock = $this->getMockBuilder('Magento\\Framework\\View\\Result\\PageFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock(); $this->resultForwardFactoryMock = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\ForwardFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock(); $this->invoiceRepository = $this->getMockBuilder(InvoiceRepositoryInterface::class)->disableOriginalConstructor()->getMockForAbstractClass(); $this->controller = $objectManager->getObject('Magento\\Sales\\Controller\\Adminhtml\\Order\\Invoice\\View', ['context' => $contextMock, 'resultPageFactory' => $this->resultPageFactoryMock, 'resultForwardFactory' => $this->resultForwardFactoryMock]); $objectManager->setBackwardCompatibleProperty($this->controller, 'invoiceRepository', $this->invoiceRepository); }
/** * Retrieve resource model mock instance and its adapter * * @return array * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ protected function _prepareResourceModel() { $connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['_connect', 'delete', 'describeTable', 'fetchRow', 'insert', 'lastInsertId', 'quote', 'update', 'beginTransaction', 'commit', 'rollback', 'select'], [], '', false); $connectionMock->expects($this->any())->method('describeTable')->with('eav_attribute')->will($this->returnValue($this->_describeEavAttribute())); $connectionMock->expects($this->any())->method('quote')->will($this->returnValueMap([[123, 123], ['4', '"4"'], ['a_dropdown', '"a_dropdown"'], ['status', '"status"']])); $this->selectMock = $this->getMock('\\Magento\\Framework\\DB\\Select', [], [], '', false); $connectionMock->expects($this->any())->method('select')->willReturn($this->selectMock); $this->selectMock->expects($this->any())->method('from')->willReturnSelf(); $this->selectMock->expects($this->any())->method('where')->willReturnSelf(); $storeManager = $this->getMock('Magento\\Store\\Model\\StoreManager', ['getStores'], [], '', false); $storeManager->expects($this->any())->method('getStores')->with(true)->will($this->returnValue([new \Magento\Framework\DataObject(['id' => 0]), new \Magento\Framework\DataObject(['id' => 1])])); /** @var $resource \Magento\Framework\App\ResourceConnection */ $resource = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false, false); $resource->expects($this->any())->method('getTableName')->will($this->returnArgument(0)); $resource->expects($this->any())->method('getConnection')->with()->will($this->returnValue($connectionMock)); $eavEntityType = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Type', [], [], '', false, false); $relationProcessorMock = $this->getMock('\\Magento\\Framework\\Model\\ResourceModel\\Db\\ObjectRelationProcessor', [], [], '', false); $contextMock = $this->getMock('\\Magento\\Framework\\Model\\ResourceModel\\Db\\Context', [], [], '', false); $contextMock->expects($this->once())->method('getResources')->willReturn($resource); $contextMock->expects($this->once())->method('getObjectRelationProcessor')->willReturn($relationProcessorMock); $configMock = $this->getMockBuilder(\Magento\Eav\Model\Config::class)->disableOriginalConstructor()->getMock(); $attributeCacheMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\AttributeCache::class)->disableOriginalConstructor()->getMock(); $arguments = ['context' => $contextMock, 'storeManager' => $storeManager, 'eavEntityType' => $eavEntityType]; $helper = new ObjectManager($this); $resourceModel = $helper->getObject(\Magento\Eav\Model\ResourceModel\Entity\Attribute::class, $arguments); $helper->setBackwardCompatibleProperty($resourceModel, 'config', $configMock); $helper->setBackwardCompatibleProperty($resourceModel, 'attributeCache', $attributeCacheMock); return [$connectionMock, $resourceModel]; }