Beispiel #1
0
 /**
  * @param $attrCode
  * @param $attrClass
  * @param $customAttrClass
  * @param $result
  * @dataProvider getAttributeValidationClassDataProvider
  */
 public function testGetAttributeValidationClass($attrCode, $attrClass, $customAttrClass, $result)
 {
     $attributeMock = $this->getMockBuilder('Magento\\Customer\\Service\\V1\\Data\\Eav\\AttributeMetadata')->disableOriginalConstructor()->getMock();
     $attributeMock->expects($this->any())->method('getFrontendClass')->will($this->returnValue($attrClass));
     $customAttrMock = $this->getMockBuilder('Magento\\Customer\\Service\\V1\\Data\\Eav\\AttributeMetadata')->disableOriginalConstructor()->getMock();
     $customAttrMock->expects($this->any())->method('isVisible')->will($this->returnValue(true));
     $customAttrMock->expects($this->any())->method('getFrontendClass')->will($this->returnValue($customAttrClass));
     $this->customerMetadataService->expects($this->any())->method('getAttributeMetadata')->will($this->returnValueMap(array(array('customer_address', $attrCode, $attributeMock), array('customer', $attrCode, $customAttrMock))));
     $this->assertEquals($result, $this->helper->getAttributeValidationClass($attrCode));
 }
 /**
  * @param $attrCode
  * @param $attrClass
  * @param $customAttrClass
  * @param $result
  * @dataProvider getAttributeValidationClassDataProvider
  */
 public function testGetAttributeValidationClass($attrCode, $attrClass, $customAttrClass, $result)
 {
     $attributeMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\AttributeMetadataInterface')->getMock();
     $attributeMock->expects($this->any())->method('getFrontendClass')->will($this->returnValue($attrClass));
     $customAttrMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\AttributeMetadataInterface')->getMock();
     $customAttrMock->expects($this->any())->method('isVisible')->will($this->returnValue(true));
     $customAttrMock->expects($this->any())->method('getFrontendClass')->will($this->returnValue($customAttrClass));
     $this->customerMetadataService->expects($this->any())->method('getAttributeMetadata')->will($this->returnValue($customAttrMock));
     $this->addressMetadataService->expects($this->any())->method('getAttributeMetadata')->will($this->returnValue($attributeMock));
     $this->assertEquals($result, $this->helper->getAttributeValidationClass($attrCode));
 }
 /**
  * @param $attributeCode
  * @dataProvider getAttributeValidationClass
  */
 public function testGetAttributeValidationClass($attributeCode, $expectedClass)
 {
     $this->assertEquals($expectedClass, $this->helper->getAttributeValidationClass($attributeCode));
 }