public function testGetAttributeMetadataWithoutAttributeMetadata() { $this->attributeMetadataDataProvider->expects($this->any())->method('getAttribute')->will($this->returnValue(false)); try { $this->service->getAttributeMetadata('attributeId'); $this->fail('Expected exception not thrown.'); } catch (NoSuchEntityException $e) { $this->assertSame("No such entity with entityType = customer, attributeCode = attributeId", $e->getMessage()); } }
/** * {@inheritdoc} */ public function getAllAttributesMetadata() { /** @var AbstractAttribute[] $attribute */ $attributeCodes = $this->attributeMetadataDataProvider->getAllAttributeCodes(self::ENTITY_TYPE_CUSTOMER, self::ATTRIBUTE_SET_ID_CUSTOMER); $attributesMetadata = []; foreach ($attributeCodes as $attributeCode) { try { $attributesMetadata[] = $this->getAttributeMetadata($attributeCode); } catch (NoSuchEntityException $e) { //If no such entity, skip } } return $attributesMetadata; }