/**
  * @expectedException \Magento\Framework\Exception\NoSuchEntityException
  * @expectedExceptionMessage No such entity with entityType = type, attributeCode = code
  */
 public function testGetModelByAttributeWithoutModel()
 {
     $entityType = 'type';
     $attributeCode = 'code';
     /** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $attributeMock */
     $attributeMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\AttributeMetadataInterface')->disableOriginalConstructor()->getMock();
     $attributeMock->expects($this->exactly(2))->method('getAttributeCode')->willReturn($attributeCode);
     $this->metadataDataProviderMock->expects($this->once())->method('getAttribute')->with($entityType, $attributeCode)->willReturn(false);
     $this->model->getModelByAttribute($entityType, $attributeMock);
 }
 public function testGetCustomAttributesMetadataWithoutAttributes()
 {
     $attributeCode = 'id';
     $attributeCodes = [$attributeCode];
     $this->attributeProviderMock->expects($this->once())->method('getAllAttributeCodes')->with(AddressMetadataInterface::ENTITY_TYPE_ADDRESS, AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS)->willReturn($attributeCodes);
     /** @var AbstractAttribute|\PHPUnit_Framework_MockObject_MockObject $attributeMock */
     $attributeMock = $this->getMockBuilder('Magento\\Eav\\Model\\Entity\\Attribute\\AbstractAttribute')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->attributeProviderMock->expects($this->once())->method('getAttribute')->with(AddressMetadataInterface::ENTITY_TYPE_ADDRESS, $attributeCode)->willReturn($attributeMock);
     /** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $metadataMock */
     $metadataMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\AttributeMetadataInterface')->disableOriginalConstructor()->getMock();
     $result = [];
     $this->attributeConverterMock->expects($this->once())->method('createMetadataAttribute')->with($attributeMock)->willReturn($metadataMock);
     $metadataMock->expects($this->once())->method('getAttributeCode')->willReturn($attributeCode);
     $this->assertEquals($result, $this->model->getCustomAttributesMetadata());
 }