File tree 2 files changed +14
-2
lines changed
Controller/Adminhtml/Product/Initialization/Helper/Plugin
Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/Plugin
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ protected function processBundleOptionsData(\Magento\Catalog\Model\Product $prod
127
127
}
128
128
$ options = [];
129
129
foreach ($ bundleOptionsData as $ key => $ optionData ) {
130
- if (( bool ) $ optionData ['delete ' ]) {
130
+ if (! empty ( $ optionData ['delete ' ]) ) {
131
131
continue ;
132
132
}
133
133
Original file line number Diff line number Diff line change @@ -57,7 +57,10 @@ protected function setUp()
57
57
'setOptions ' ,
58
58
'setCanSaveBundleSelections ' ,
59
59
'__wakeup ' ,
60
- 'getOptionsReadonly '
60
+ 'getOptionsReadonly ' ,
61
+ 'getBundleOptionsData ' ,
62
+ 'getExtensionAttributes ' ,
63
+ 'setExtensionAttributes ' ,
61
64
];
62
65
$ this ->productMock = $ this ->createPartialMock (\Magento \Catalog \Model \Product::class, $ methods );
63
66
$ optionInterfaceFactory = $ this ->getMockBuilder (\Magento \Bundle \Api \Data \OptionInterfaceFactory::class)
@@ -127,6 +130,15 @@ public function testAfterInitializeIfBundleAnsCustomOptionsAndBundleSelectionsEx
127
130
);
128
131
$ this ->productMock ->expects ($ this ->once ())->method ('setOptions ' )->with (null );
129
132
$ this ->productMock ->expects ($ this ->once ())->method ('setCanSaveBundleSelections ' )->with (true );
133
+ $ this ->productMock ->expects ($ this ->once ())->method ('getBundleOptionsData ' )->willReturn (['option_1 ' => ['delete ' => 1 ]]);
134
+ $ extentionAttribute = $ this ->getMockBuilder (\Magento \Catalog \Api \Data \ProductExtensionInterface::class)
135
+ ->disableOriginalConstructor ()
136
+ ->setMethods (['setBundleProductOptions ' ])
137
+ ->getMockForAbstractClass ();
138
+ $ extentionAttribute ->expects ($ this ->once ())->method ('setBundleProductOptions ' )->with ([]);
139
+ $ this ->productMock ->expects ($ this ->once ())->method ('getExtensionAttributes ' )->willReturn ($ extentionAttribute );
140
+ $ this ->productMock ->expects ($ this ->once ())->method ('setExtensionAttributes ' )->with ($ extentionAttribute );
141
+
130
142
$ this ->model ->afterInitialize ($ this ->subjectMock , $ this ->productMock );
131
143
}
132
144
You can’t perform that action at this time.
0 commit comments