/** * @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(); }