Esempio n. 1
0
 /**
  * @covers \Magento\Catalog\Service\V1\Product\AttributeSet\AttributeService::addAttribute
  * @expectedException \Magento\Framework\Exception\InputException
  * @expectedExceptionMessage Attribute does not exist
  */
 public function testAddAttributeWithWrongAttribute()
 {
     $builder = $this->objectHelper->getObject('Magento\\Catalog\\Service\\V1\\Data\\Eav\\AttributeSet\\AttributeBuilder');
     $attributeDataObject = $builder->populateWithArray(['attribute_group' => 0])->create();
     $objectMock = $this->getMock('\\Magento\\Framework\\Object', array(), array(), '', false);
     $objectMock->expects($this->any())->method('getId')->will($this->returnValue(1));
     $this->attributeSetMock->expects($this->once())->method('load')->will($this->returnValue($objectMock));
     $this->attributeGroupMock->expects($this->once())->method('load')->will($this->returnValue($objectMock));
     $entityCode = \Magento\Catalog\Model\Product::ENTITY;
     $this->entityTypeConfigMock->expects($this->once())->method('getEntityType')->will($this->returnSelf());
     $this->entityTypeConfigMock->expects($this->once())->method('getEntityTypeCode')->will($this->returnValue($entityCode));
     $attributeMock = $this->getMock('\\Magento\\Framework\\Object', array(), array(), '', false);
     $this->attributeMock->expects($this->once())->method('load')->will($this->returnValue($attributeMock));
     $this->service->addAttribute(1, $attributeDataObject);
 }