23 $this->metadataDataProviderMock = $this->getMockBuilder(
25 )->disableOriginalConstructor()->getMock();
28 $this->metadataDataProviderMock
32 public function testGetModelByAttribute()
38 $attributeMock = $this->getMockBuilder(\
Magento\
Customer\Api\Data\AttributeMetadataInterface::class)
39 ->disableOriginalConstructor()
41 $attributeMock->expects($this->once())
42 ->method(
'getAttributeCode')
46 $modelMock = $this->getMockBuilder(\
Magento\
Customer\Model\Attribute::class)
47 ->disableOriginalConstructor()
50 $this->metadataDataProviderMock->expects($this->once())
51 ->method(
'getAttribute')
53 ->willReturn($modelMock);
55 $this->assertEquals($modelMock, $this->model->getModelByAttribute(
$entityType, $attributeMock));
62 public function testGetModelByAttributeWithoutModel()
68 $attributeMock = $this->getMockBuilder(\
Magento\
Customer\Api\Data\AttributeMetadataInterface::class)
69 ->disableOriginalConstructor()
71 $attributeMock->expects($this->exactly(2))
72 ->method(
'getAttributeCode')
75 $this->metadataDataProviderMock->expects($this->once())
76 ->method(
'getAttribute')
80 $this->model->getModelByAttribute(
$entityType, $attributeMock);