/** * {@inheritdoc} */ public function save(\Magento\Catalog\Api\Data\ProductAttributeInterface $attribute) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'save'); if (!$pluginInfo) { return parent::save($attribute); } else { return $this->___callPlugins('save', func_get_args(), $pluginInfo); } }
/** * @expectedException \Magento\Framework\Exception\InputException * @expectedExceptionMessage Invalid value of "" provided for the frontend_label field. */ public function testSaveInputExceptionInvalidFieldValue() { $attributeMock = $this->getMock('Magento\\Catalog\\Model\\Resource\\Eav\\Attribute', ['getFrontendLabels', 'getDefaultFrontendLabel', 'getAttributeId', '__wakeup', 'setAttributeId'], [], '', false); $attributeMock->expects($this->once())->method('getAttributeId')->willReturn(null); $attributeMock->expects($this->once())->method('setAttributeId')->with(null)->willReturnSelf(); $labelMock = $this->getMock('Magento\\Eav\\Api\\Data\\AttributeFrontendLabelInterface', [], [], '', false); $attributeMock->expects($this->exactly(4))->method('getFrontendLabels')->willReturn([$labelMock]); $attributeMock->expects($this->exactly(2))->method('getDefaultFrontendLabel')->willReturn('test'); $labelMock->expects($this->once())->method('getStoreId')->willReturn(0); $labelMock->expects($this->once())->method('getLabel')->willReturn(null); $this->model->save($attributeMock); }