/** * Test NoSuchEntityException getAttributeMetadata * @expectedException \Magento\Framework\Exception\NoSuchEntityException * @expectedExceptionMessage No such entity with attributeCode = attr_code */ public function testGetAttributeMetadataNoSuchEntityException() { $data = ['attribute_id' => 1, 'attribute_code' => 'description', 'frontend_label' => 'English', 'store_labels' => array(1 => 'France'), 'frontend_input' => 'textarea']; $attributeMock = $this->getMock('Magento\\Framework\\Object', array('getId'), array('data' => $data)); $this->eavConfigMock->expects($this->once())->method('getAttribute')->will($this->returnValue($attributeMock)); $attributeMock->expects($this->once())->method('getId')->will($this->returnValue(null)); $this->service->getAttributeMetadata('entity_type', 'attr_code'); }