17 'name' =>
'attribute set name',
22 'is_visible_on_front' => 1,
23 'is_visible_in_advanced_search' => 0,
25 'is_filterable_in_search' => 0,
26 'attribute_code' =>
'attribute_1',
28 'frontend_label' =>
'Attribute 1',
29 'frontend_input' =>
'select',
31 'default_option' =>
'option 1',
35 'label' =>
'option 1',
46 $attributeSetMock = $this->getMockBuilder(\
Magento\Eav\Api\Data\AttributeSetInterface::class)
47 ->disableOriginalConstructor()
49 $attributeSetMock->expects($this->once())
50 ->method(
'setAttributeSetName')
51 ->with(
"attribute set name");
52 $attributeSetMock->expects($this->once())
53 ->method(
'setEntityTypeId')
54 ->with(\
Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE);
55 $attributeSetMock->expects($this->any())
56 ->method(
'getAttributeSetName')
57 ->willReturn($attributeSets[
'name']);
59 $attributeSetFactoryMock = $this->getMockBuilder(\
Magento\Eav\Api\Data\AttributeSetInterfaceFactory::class)
60 ->disableOriginalConstructor()
61 ->setMethods([
'create'])
63 $attributeSetFactoryMock->expects($this->once())
65 ->willReturn($attributeSetMock);
67 $attributeSetManagementMock = $this->getMockBuilder(\
Magento\Catalog\Api\AttributeSetManagementInterface::class)
68 ->disableOriginalConstructor()
70 $attributeSetManagementMock->expects($this->once())
72 ->with($attributeSetMock,
'4')
73 ->willReturn($attributeSetMock);
76 $attributeGroupMock = $this->getMockBuilder(\
Magento\Eav\Api\Data\AttributeGroupInterface::class)
77 ->disableOriginalConstructor()
79 $attributeGroupMock->expects($this->once())
80 ->method(
'setAttributeGroupName')
81 ->with($attributeSetMock->getAttributeSetName() .
' - Group');
82 $attributeGroupMock->expects($this->once())
83 ->method(
'setAttributeSetId')
84 ->with($attributeSetMock->getAttributeSetId());
86 $attributeGroupFactoryMock = $this->getMockBuilder(\
Magento\Eav\Api\Data\AttributeGroupInterfaceFactory::class)
87 ->disableOriginalConstructor()
88 ->setMethods([
'create'])
90 $attributeGroupFactoryMock->expects($this->once())
92 ->willReturn($attributeGroupMock);
94 $productAttributeGroupRepoMock = $this->getMockBuilder(
95 \
Magento\Catalog\Api\ProductAttributeGroupRepositoryInterface::class
97 ->disableOriginalConstructor()
99 $productAttributeGroupRepoMock->expects($this->once())
101 ->with($attributeGroupMock)
102 ->willReturn($attributeGroupMock);
105 $attributeMock = $this->getMockBuilder(\
Magento\Catalog\Api\Data\ProductAttributeInterface::class)
106 ->disableOriginalConstructor()
109 $attributeFactoryMock = $this->getMockBuilder(\
Magento\Catalog\Api\Data\ProductAttributeInterfaceFactory::class)
110 ->disableOriginalConstructor()
111 ->setMethods([
'create'])
113 $attributeFactoryMock->expects($this->once())
115 ->willReturn($attributeMock);
118 $optionMock = $this->getMockBuilder(\
Magento\Eav\Api\Data\AttributeOptionInterface::class)
119 ->disableOriginalConstructor()
122 $optionFactoryMock = $this->getMockBuilder(\
Magento\Eav\Api\Data\AttributeOptionInterfaceFactory::class)
123 ->disableOriginalConstructor()
124 ->setMethods([
'create'])
126 $optionFactoryMock->expects($this->once())
128 ->willReturn($optionMock);
130 $productAttributeRepoMock = $this->getMockBuilder(
131 \
Magento\Catalog\Api\ProductAttributeRepositoryInterface::class
133 ->disableOriginalConstructor()
135 $productAttributeRepoMock->expects($this->once())
137 ->with($attributeMock)
138 ->willReturn($attributeMock);
140 $productAttributeManagementMock = $this->getMockBuilder(
141 \
Magento\Catalog\Api\ProductAttributeManagementInterface::class
143 ->disableOriginalConstructor()
145 $productAttributeManagementMock->expects($this->once())
147 ->willReturn($attributeMock->getAttributeId());
149 $attributeSet = new \Magento\Setup\Fixtures\AttributeSet\AttributeSetFixture(
150 $attributeSetManagementMock,
151 $productAttributeGroupRepoMock,
152 $productAttributeRepoMock,
153 $productAttributeManagementMock,
154 $attributeFactoryMock,
156 $attributeSetFactoryMock,
157 $attributeGroupFactoryMock