public function testSetCustomAttributesAsLiterals() { $this->model->expects($this->any())->method('getCustomAttributesCodes')->willReturn([]); $attributeCode = 'attribute2'; $attributeValue = 'attribute_value'; $attributeMock = $this->getMockBuilder('\\Magento\\Framework\\Api\\AttributeValue')->disableOriginalConstructor()->getMock(); $attributeMock->expects($this->never())->method('setAttributeCode')->with($attributeCode)->will($this->returnSelf()); $attributeMock->expects($this->never())->method('setValue')->with($attributeValue)->will($this->returnSelf()); $this->attributeValueFactoryMock->expects($this->never())->method('create')->willReturn($attributeMock); $this->model->setData(\Magento\Framework\Api\CustomAttributesDataInterface::CUSTOM_ATTRIBUTES, [$attributeCode => $attributeValue]); }