@@ -107,6 +107,7 @@ protected function setUp()
107
107
];
108
108
$ attribute1 = clone $ attribute ;
109
109
$ attribute2 = clone $ attribute ;
110
+ $ attribute3 = clone $ attribute ;
110
111
111
112
$ attribute1 ->expects ($ this ->any ())->method ('getId ' )->willReturn ('1 ' );
112
113
$ attribute1 ->expects ($ this ->any ())->method ('getAttributeCode ' )->willReturn ('attr_code ' );
@@ -118,6 +119,11 @@ protected function setUp()
118
119
$ attribute2 ->expects ($ this ->any ())->method ('getFrontendInput ' )->willReturn ('boolean ' );
119
120
$ attribute2 ->expects ($ this ->any ())->method ('isStatic ' )->willReturn (false );
120
121
122
+ $ attribute3 ->expects ($ this ->any ())->method ('getId ' )->willReturn ('3 ' );
123
+ $ attribute3 ->expects ($ this ->any ())->method ('getAttributeCode ' )->willReturn ('text_attribute ' );
124
+ $ attribute3 ->expects ($ this ->any ())->method ('getFrontendInput ' )->willReturn ('text ' );
125
+ $ attribute3 ->expects ($ this ->any ())->method ('isStatic ' )->willReturn (false );
126
+
121
127
$ this ->entityModel ->expects ($ this ->any ())->method ('getEntityTypeId ' )->willReturn (3 );
122
128
$ this ->entityModel ->expects ($ this ->any ())->method ('getAttributeOptions ' )->willReturnOnConsecutiveCalls (
123
129
['option1 ' , 'option2 ' ],
@@ -126,7 +132,9 @@ protected function setUp()
126
132
$ attrSetColFactory ->expects ($ this ->any ())->method ('create ' )->willReturn ($ attrSetCollection );
127
133
$ attrSetCollection ->expects ($ this ->any ())->method ('setEntityTypeFilter ' )->willReturn ([$ attributeSet ]);
128
134
$ attrColFactory ->expects ($ this ->any ())->method ('create ' )->willReturn ($ attrCollection );
129
- $ attrCollection ->expects ($ this ->any ())->method ('setAttributeSetFilter ' )->willReturn ([$ attribute1 , $ attribute2 ]);
135
+ $ attrCollection ->expects ($ this ->any ())
136
+ ->method ('setAttributeSetFilter ' )
137
+ ->willReturn ([$ attribute1 , $ attribute2 , $ attribute3 ]);
130
138
$ attributeSet ->expects ($ this ->any ())->method ('getId ' )->willReturn (1 );
131
139
$ attributeSet ->expects ($ this ->any ())->method ('getAttributeSetName ' )->willReturn ('attribute_set_name ' );
132
140
@@ -157,7 +165,7 @@ protected function setUp()
157
165
],
158
166
]
159
167
)
160
- ->willReturn ([$ attribute1 , $ attribute2 ]);
168
+ ->willReturn ([$ attribute1 , $ attribute2, $ attribute3 ]);
161
169
162
170
$ this ->connection = $ this ->createPartialMock (\Magento \Framework \DB \Adapter \Pdo \Mysql::class, [
163
171
'select ' ,
@@ -364,9 +372,14 @@ public function testPrepareAttributesWithDefaultValueForSave()
364
372
{
365
373
$ rowData = [
366
374
'_attribute_set ' => 'attributeSetName ' ,
367
- 'boolean_attribute ' => 'Yes '
375
+ 'boolean_attribute ' => 'Yes ' ,
376
+ ];
377
+
378
+ $ expected = [
379
+ 'boolean_attribute ' => 1 ,
380
+ 'text_attribute ' => 'default_value '
368
381
];
369
382
$ result = $ this ->simpleType ->prepareAttributesWithDefaultValueForSave ($ rowData );
370
- $ this ->assertEquals ([ ' boolean_attribute ' => 1 ] , $ result );
383
+ $ this ->assertEquals ($ expected , $ result );
371
384
}
372
385
}
0 commit comments