public function testCanBeFilterableInGrid()
 {
     /** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $attributeMock */
     $attributeMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\AttributeMetadataInterface')->getMockForAbstractClass();
     /** @var Attribute|\PHPUnit_Framework_MockObject_MockObject $modelMock */
     $modelMock = $this->getMockBuilder('Magento\\Customer\\Model\\Attribute')->disableOriginalConstructor()->getMock();
     $this->attributeResolverMock->expects($this->once())->method('getModelByAttribute')->with(CustomerMetadataManagement::ENTITY_TYPE_CUSTOMER, $attributeMock)->willReturn($modelMock);
     $modelMock->expects($this->once())->method('canBeFilterableInGrid')->willReturn(true);
     $this->assertTrue($this->model->canBeFilterableInGrid($attributeMock));
 }
 /**
  * @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);
 }
 /**
  * {@inheritdoc}
  */
 public function canBeFilterableInGrid(AttributeMetadataInterface $attribute)
 {
     return $this->attributeResolver->getModelByAttribute(self::ENTITY_TYPE_ADDRESS, $attribute)->canBeFilterableInGrid();
 }