@@ -113,16 +113,13 @@ protected function setUp(): void
113
113
*/
114
114
public function testBeforeSaveWhenProductIsSimple (): void
115
115
{
116
- $ this ->product ->expects (static ::once ( ))
116
+ $ this ->product ->expects (static ::atMost ( 1 ))
117
117
->method ('getTypeId ' )
118
118
->willReturn ('simple ' );
119
- $ this ->product ->expects (static ::never ())
119
+ $ this ->product ->expects (static ::once ())
120
120
->method ('getExtensionAttributes ' );
121
121
122
- $ this ->assertEquals (
123
- $ this ->product ,
124
- $ this ->plugin ->beforeSave ($ this ->productRepository , $ this ->product )[0 ]
125
- );
122
+ $ this ->assertNull ($ this ->plugin ->beforeSave ($ this ->productRepository , $ this ->product ));
126
123
}
127
124
128
125
/**
@@ -150,52 +147,7 @@ public function testBeforeSaveWithoutOptions(): void
150
147
$ this ->productAttributeRepository ->expects (static ::never ())
151
148
->method ('get ' );
152
149
153
- $ this ->assertEquals (
154
- $ this ->product ,
155
- $ this ->plugin ->beforeSave ($ this ->productRepository , $ this ->product )[0 ]
156
- );
157
- }
158
-
159
- /**
160
- * Test saving a configurable product with same set of attribute values
161
- *
162
- * @return void
163
- */
164
- public function testBeforeSaveWithLinks (): void
165
- {
166
- $ this ->expectException (InputException::class);
167
- $ this ->expectExceptionMessage ('Products "5" and "4" have the same set of attribute values. ' );
168
- $ links = [4 , 5 ];
169
- $ this ->product ->expects (static ::once ())
170
- ->method ('getTypeId ' )
171
- ->willReturn (Configurable::TYPE_CODE );
172
-
173
- $ this ->product ->expects (static ::once ())
174
- ->method ('getExtensionAttributes ' )
175
- ->willReturn ($ this ->extensionAttributes );
176
- $ this ->extensionAttributes ->expects (static ::once ())
177
- ->method ('getConfigurableProductOptions ' )
178
- ->willReturn (null );
179
- $ this ->extensionAttributes ->expects (static ::once ())
180
- ->method ('getConfigurableProductLinks ' )
181
- ->willReturn ($ links );
182
-
183
- $ this ->productAttributeRepository ->expects (static ::never ())
184
- ->method ('get ' );
185
-
186
- $ product = $ this ->getMockBuilder (Product::class)
187
- ->disableOriginalConstructor ()
188
- ->setMethods (['getData ' ])
189
- ->getMock ();
190
-
191
- $ this ->productRepository ->expects (static ::exactly (2 ))
192
- ->method ('getById ' )
193
- ->willReturn ($ product );
194
-
195
- $ product ->expects (static ::never ())
196
- ->method ('getData ' );
197
-
198
- $ this ->plugin ->beforeSave ($ this ->productRepository , $ this ->product );
150
+ $ this ->assertNull ($ this ->plugin ->beforeSave ($ this ->productRepository , $ this ->product ));
199
151
}
200
152
201
153
/**
0 commit comments