/** * Test getType method * * @param string $attributeCode * @param string $serviceClass * @param array $attributeRepositoryResponse * @param \Magento\Framework\Stdlib\String $stringUtility, * @param array $serviceEntityTypeMapData * @param array $serviceBackendModelDataInterfaceMapData * @param string $expected * @dataProvider getTypeDataProvider */ public function testGetType($attributeCode, $serviceClass, $attributeRepositoryResponse, $stringUtility, $serviceEntityTypeMapData, $serviceBackendModelDataInterfaceMapData, $expected) { $this->attributeRepository->expects($this->any())->method('get')->willReturn($attributeRepositoryResponse); $this->eavCustomAttributeTypeLocator = new EavCustomAttributeTypeLocator($this->attributeRepository, $stringUtility, $serviceEntityTypeMapData, $serviceBackendModelDataInterfaceMapData); $type = $this->eavCustomAttributeTypeLocator->getType($attributeCode, $serviceClass); $this->assertEquals($expected, $type, 'Expected: ' . $expected . 'but got: ' . $type); }
public function testGetTypeIfAttributeDoesNotExist() { $this->attributeRepository->expects($this->any())->method('get')->willReturn(new \Magento\Framework\Exception\NoSuchEntityException()); $this->eavCustomAttributeTypeLocator = new EavCustomAttributeTypeLocator($this->attributeRepository, new \Magento\Framework\Stdlib\StringUtils(), [], []); $this->assertNull($this->eavCustomAttributeTypeLocator->getType('media_galley', 'Magento\\Catalog\\Api\\Data\\ProductInterface')); }