File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Model/Product/Attribute/Backend/GroupPrice
Test/Unit/Model/Product/Attribute/Backend Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -358,7 +358,7 @@ protected function modifyPriceData($object, $data)
358358 {
359359 /** @var array $priceItem */
360360 foreach ($ data as $ key => $ priceItem ) {
361- if (isset ( $ priceItem [ 'price ' ]) && $ priceItem[ ' price ' ] > 0 ) {
361+ if (array_key_exists ( 'price ' , $ priceItem) ) {
362362 $ data [$ key ]['website_price ' ] = $ priceItem ['price ' ];
363363 }
364364 if ($ priceItem ['all_groups ' ]) {
Original file line number Diff line number Diff line change @@ -141,6 +141,10 @@ public function testSetPriceData()
141141 {
142142 $ attributeName = 'tier_price ' ;
143143 $ tierPrices = [
144+ [
145+ 'price ' => 0 ,
146+ 'all_groups ' => 1 ,
147+ ],
144148 [
145149 'price ' => 10 ,
146150 'all_groups ' => 1 ,
@@ -153,6 +157,12 @@ public function testSetPriceData()
153157 $ productPrice = 20 ;
154158 $ allCustomersGroupId = 32000 ;
155159 $ finalTierPrices = [
160+ [
161+ 'price ' => 0 ,
162+ 'all_groups ' => 1 ,
163+ 'website_price ' => 0 ,
164+ 'cust_group ' => 32000 ,
165+ ],
156166 [
157167 'price ' => 10 ,
158168 'all_groups ' => 1 ,
@@ -170,8 +180,11 @@ public function testSetPriceData()
170180 ->disableOriginalConstructor ()->getMock ();
171181 $ allCustomersGroup = $ this ->getMockBuilder (\Magento \Customer \Api \Data \GroupInterface::class)
172182 ->disableOriginalConstructor ()->getMock ();
173- $ this ->groupManagement ->expects ($ this ->once ())->method ('getAllCustomersGroup ' )->willReturn ($ allCustomersGroup );
174- $ allCustomersGroup ->expects ($ this ->once ())->method ('getId ' )->willReturn ($ allCustomersGroupId );
183+ $ this ->groupManagement
184+ ->expects ($ this ->exactly (2 ))
185+ ->method ('getAllCustomersGroup ' )
186+ ->willReturn ($ allCustomersGroup );
187+ $ allCustomersGroup ->expects ($ this ->exactly (2 ))->method ('getId ' )->willReturn ($ allCustomersGroupId );
175188 $ object ->expects ($ this ->once ())->method ('getPrice ' )->willReturn ($ productPrice );
176189 $ this ->attribute ->expects ($ this ->atLeastOnce ())->method ('isScopeGlobal ' )->willReturn (true );
177190 $ object ->expects ($ this ->once ())->method ('getStoreId ' )->willReturn (null );
You can’t perform that action at this time.
0 commit comments