34 $this->attrSetManagementMock = $this->createMock(\
Magento\Eav\Api\AttributeSetManagementInterface::class);
35 $this->attributeSetRepository = $this->createMock(\
Magento\Eav\Api\AttributeSetRepositoryInterface::class);
36 $this->eavConfig = $this->createMock(\
Magento\Eav\Model\Config::class);
37 $this->model = new \Magento\Catalog\Model\Product\Attribute\SetManagement(
38 $this->attrSetManagementMock,
39 $this->attributeSetRepository,
47 $attributeSetMock = $this->createMock(\
Magento\Eav\Api\Data\AttributeSetInterface::class);
48 $skeletonSetMock = $this->createMock(\
Magento\Eav\Api\Data\AttributeSetInterface::class);
50 $this->attributeSetRepository->expects($this->once())
53 ->willReturn($skeletonSetMock);
55 $typeMock = $this->createMock(\
Magento\Eav\Model\Entity\Type::class);
56 $typeMock->expects($this->once())->method(
'getId')->willReturn(4);
57 $this->eavConfig->expects($this->once())
58 ->method(
'getEntityType')
60 ->willReturn($typeMock);
61 $skeletonSetMock->expects($this->once())->method(
'getEntityTypeId')->willReturn(4);
63 $this->attrSetManagementMock->expects($this->once())
69 )->willReturn($attributeSetMock);
70 $this->assertEquals($attributeSetMock, $this->model->create($attributeSetMock, $skeletonId));
79 $attributeSetMock = $this->createMock(\
Magento\Eav\Api\Data\AttributeSetInterface::class);
80 $skeletonSetMock = $this->createMock(\
Magento\Eav\Api\Data\AttributeSetInterface::class);
81 $this->attributeSetRepository->expects($this->once())
84 ->willReturn($skeletonSetMock);
86 $typeMock = $this->createMock(\
Magento\Eav\Model\Entity\Type::class);
87 $typeMock->expects($this->once())->method(
'getId')->willReturn(4);
88 $this->eavConfig->expects($this->once())
89 ->method(
'getEntityType')
91 ->willReturn($typeMock);
92 $skeletonSetMock->expects($this->once())->method(
'getEntityTypeId')->willReturn(3);
93 $this->model->create($attributeSetMock, $skeletonId);
95 $this->expectExceptionMessage(
96 "The attribute set couldn't be created because it's based on a non-product attribute set."
testCreateNonProductAttributeSet()