77
88namespace Magento \Catalog \Test \Unit \Controller \Adminhtml \Product \Attribute ;
99
10+ use Magento \Backend \Model \Session ;
11+ use Magento \Backend \Model \View \Result \Redirect as ResultRedirect ;
1012use Magento \Catalog \Api \Data \ProductAttributeInterface ;
1113use Magento \Catalog \Controller \Adminhtml \Product \Attribute \Save ;
12- use Magento \Eav \Model \Validator \Attribute \Code as AttributeCodeValidator ;
13- use Magento \Framework \Serialize \Serializer \FormData ;
14- use Magento \Catalog \Test \Unit \Controller \Adminhtml \Product \AttributeTest ;
15- use Magento \Catalog \Model \Product \AttributeSet \BuildFactory ;
14+ use Magento \Catalog \Helper \Product as ProductHelper ;
15+ use Magento \Catalog \Model \Product \Attribute \Frontend \Inputtype \Presentation ;
1616use Magento \Catalog \Model \Product \AttributeSet \Build ;
17+ use Magento \Catalog \Model \Product \AttributeSet \BuildFactory ;
1718use Magento \Catalog \Model \ResourceModel \Eav \AttributeFactory ;
19+ use Magento \Catalog \Test \Unit \Controller \Adminhtml \Product \AttributeTest ;
1820use Magento \Eav \Api \Data \AttributeSetInterface ;
21+ use Magento \Eav \Model \Adminhtml \System \Config \Source \Inputtype \Validator as InputTypeValidator ;
1922use Magento \Eav \Model \Adminhtml \System \Config \Source \Inputtype \ValidatorFactory ;
2023use Magento \Eav \Model \ResourceModel \Entity \Attribute \Group \CollectionFactory ;
24+ use Magento \Eav \Model \Validator \Attribute \Code as AttributeCodeValidator ;
2125use Magento \Framework \Controller \ResultFactory ;
26+ use Magento \Framework \Exception \NotFoundException ;
2227use Magento \Framework \Filter \FilterManager ;
23- use Magento \Catalog \ Helper \ Product as ProductHelper ;
28+ use Magento \Framework \ Serialize \ Serializer \ FormData ;
2429use Magento \Framework \View \Element \Messages ;
2530use Magento \Framework \View \LayoutFactory ;
26- use Magento \Backend \Model \View \Result \Redirect as ResultRedirect ;
27- use Magento \Eav \Model \Adminhtml \System \Config \Source \Inputtype \Validator as InputTypeValidator ;
2831use Magento \Framework \View \LayoutInterface ;
32+ use PHPUnit \Framework \MockObject \MockObject ;
2933
3034/**
3135 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
36+ * @SuppressWarnings(PHPMD.TooManyFields)
3237 */
3338class SaveTest extends AttributeTest
3439{
3540 /**
3641 * @var BuildFactory|MockObject
3742 */
38- protected $ buildFactoryMock ;
43+ private $ buildFactoryMock ;
3944
4045 /**
4146 * @var FilterManager|MockObject
4247 */
43- protected $ filterManagerMock ;
48+ private $ filterManagerMock ;
4449
4550 /**
4651 * @var ProductHelper|MockObject
4752 */
48- protected $ productHelperMock ;
53+ private $ productHelperMock ;
4954
5055 /**
5156 * @var AttributeFactory|MockObject
5257 */
53- protected $ attributeFactoryMock ;
58+ private $ attributeFactoryMock ;
5459
5560 /**
5661 * @var ValidatorFactory|MockObject
5762 */
58- protected $ validatorFactoryMock ;
63+ private $ validatorFactoryMock ;
5964
6065 /**
6166 * @var CollectionFactory|MockObject
6267 */
63- protected $ groupCollectionFactoryMock ;
68+ private $ groupCollectionFactoryMock ;
6469
6570 /**
6671 * @var LayoutFactory|MockObject
6772 */
68- protected $ layoutFactoryMock ;
73+ private $ layoutFactoryMock ;
6974
7075 /**
7176 * @var ResultRedirect|MockObject
7277 */
73- protected $ redirectMock ;
78+ private $ redirectMock ;
7479
7580 /**
76- * @var AttributeSet |MockObject
81+ * @var AttributeSetInterface |MockObject
7782 */
78- protected $ attributeSetMock ;
83+ private $ attributeSetMock ;
7984
8085 /**
8186 * @var Build|MockObject
8287 */
83- protected $ builderMock ;
88+ private $ builderMock ;
8489
8590 /**
8691 * @var InputTypeValidator|MockObject
8792 */
88- protected $ inputTypeValidatorMock ;
93+ private $ inputTypeValidatorMock ;
8994
9095 /**
9196 * @var FormData|MockObject
9297 */
93- protected $ formDataSerializerMock ;
98+ private $ formDataSerializerMock ;
9499
95100 /**
96101 * @var ProductAttributeInterface|MockObject
97102 */
98- protected $ productAttributeMock ;
103+ private $ productAttributeMock ;
99104
100105 /**
101- * @var Presentation |MockObject
106+ * @var AttributeCodeValidator |MockObject
102107 */
103- private $ formDataSerializerMock ;
108+ private $ attributeCodeValidatorMock ;
104109
105110 /**
106- * @var ProductAttributeInterface|\PHPUnit_Framework_MockObject_MockObject
111+ * @var Presentation|MockObject
107112 */
108- private $ productAttributeMock ;
113+ private $ presentationMock ;
109114
110115 /**
111- * @var AttributeCodeValidator |MockObject
116+ * @var Session |MockObject
112117 */
113- private $ attributeCodeValidatorMock ;
118+
119+ private $ sessionMock ;
114120
115121 protected function setUp (): void
116122 {
@@ -129,12 +135,6 @@ protected function setUp(): void
129135 ->setMethods (['create ' ])
130136 ->disableOriginalConstructor ()
131137 ->getMock ();
132- $ this ->filterManagerMock = $ this ->getMockBuilder (FilterManager::class)
133- ->disableOriginalConstructor ()
134- ->getMock ();
135- $ this ->productHelperMock = $ this ->getMockBuilder (ProductHelper::class)
136- ->disableOriginalConstructor ()
137- ->getMock ();
138138 $ this ->attributeFactoryMock = $ this ->getMockBuilder (AttributeFactory::class)
139139 ->setMethods (['create ' ])
140140 ->disableOriginalConstructor ()
@@ -147,28 +147,10 @@ protected function setUp(): void
147147 ->setMethods (['create ' ])
148148 ->disableOriginalConstructor ()
149149 ->getMock ();
150- $ this ->layoutFactoryMock = $ this ->getMockBuilder (LayoutFactory::class)
151- ->disableOriginalConstructor ()
152- ->getMock ();
153150 $ this ->redirectMock = $ this ->getMockBuilder (ResultRedirect::class)
154151 ->setMethods (['setData ' , 'setPath ' ])
155152 ->disableOriginalConstructor ()
156153 ->getMock ();
157- $ this ->attributeSetMock = $ this ->getMockBuilder (AttributeSetInterface::class)
158- ->disableOriginalConstructor ()
159- ->getMock ();
160- $ this ->builderMock = $ this ->getMockBuilder (Build::class)
161- ->disableOriginalConstructor ()
162- ->getMock ();
163- $ this ->inputTypeValidatorMock = $ this ->getMockBuilder (InputTypeValidator::class)
164- ->disableOriginalConstructor ()
165- ->getMock ();
166- $ this ->formDataSerializerMock = $ this ->getMockBuilder (FormData::class)
167- ->disableOriginalConstructor ()
168- ->getMock ();
169- $ this ->attributeCodeValidatorMock = $ this ->getMockBuilder (AttributeCodeValidator::class)
170- ->disableOriginalConstructor ()
171- ->getMock ();
172154 $ this ->productAttributeMock = $ this ->getMockBuilder (ProductAttributeInterface::class)
173155 ->setMethods (
174156 [
0 commit comments