File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
app/code/Magento/ConfigurableProduct/Test/Unit/Plugin/SalesRule/Model/Rule/Condition Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -223,4 +223,38 @@ public function testChildIsNotUsedForValidation()
223223
224224 $ this ->validatorPlugin ->beforeValidate ($ this ->validator , $ item );
225225 }
226+
227+ /**
228+ * Test for Configurable product in invalid state with no children does not raise error
229+ */
230+ public function testChildIsNotUsedForValidationWhenConfigurableProductIsMissingChildren ()
231+ {
232+ $ configurableProductMock = $ this ->createProductMock ();
233+ $ configurableProductMock
234+ ->expects ($ this ->any ())
235+ ->method ('getTypeId ' )
236+ ->willReturn (Configurable::TYPE_CODE );
237+
238+ $ configurableProductMock
239+ ->expects ($ this ->any ())
240+ ->method ('hasData ' )
241+ ->with ($ this ->equalTo ('special_price ' ))
242+ ->willReturn (false );
243+
244+ /* @var AbstractItem|\PHPUnit_Framework_MockObject_MockObject $item */
245+ $ item = $ this ->getMockBuilder (AbstractItem::class)
246+ ->disableOriginalConstructor ()
247+ ->setMethods (['setProduct ' , 'getProduct ' , 'getChildren ' ])
248+ ->getMockForAbstractClass ();
249+ $ item ->expects ($ this ->any ())
250+ ->method ('getProduct ' )
251+ ->willReturn ($ configurableProductMock );
252+ $ item ->expects ($ this ->any ())
253+ ->method ('getChildren ' )
254+ ->willReturn ([]);
255+
256+ $ this ->validator ->setAttribute ('special_price ' );
257+
258+ $ this ->validatorPlugin ->beforeValidate ($ this ->validator , $ item );
259+ }
226260}
You can’t perform that action at this time.
0 commit comments