Example #1
0
 public function testGetAttributeMetadata()
 {
     $this->attributeMetadataDataProvider->expects($this->any())->method('getAttribute')->will($this->returnValue($this->attributeEntityMock));
     $this->attributeMetadataConverter->expects($this->any())->method('createMetadataAttribute')->will($this->returnValue($this->attributeMetadataMock));
     $attributeMetadata = $this->service->getAttributeMetadata('attributeId');
     $this->assertMetadataAttributes($attributeMetadata);
 }
 /**
  * {@inheritdoc}
  */
 public function getAttributeMetadata($attributeCode)
 {
     /** @var AbstractAttribute $attribute */
     $attribute = $this->attributeMetadataDataProvider->getAttribute(self::ENTITY_TYPE_CUSTOMER, $attributeCode);
     if ($attribute) {
         $attributeMetadata = $this->attributeMetadataConverter->createMetadataAttribute($attribute);
         return $attributeMetadata;
     } else {
         throw new NoSuchEntityException(NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, ['fieldName' => 'entityType', 'fieldValue' => self::ENTITY_TYPE_CUSTOMER, 'field2Name' => 'attributeCode', 'field2Value' => $attributeCode]);
     }
 }