This repository was archived by the owner on Apr 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed
CatalogInventory/Test/Unit/Block/Plugin
Ui/view/base/web/js/lib/validation Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ protected function setUp()
28
28
29
29
$ this ->stockItem = $ this ->getMockBuilder (\Magento \CatalogInventory \Model \Stock \Item::class)
30
30
->disableOriginalConstructor ()
31
- ->setMethods (['getMinSaleQty ' , 'getQtyMaxAllowed ' , 'getQtyIncrements ' ])
31
+ ->setMethods (['getMinSaleQty ' , 'getMaxSaleQty ' , 'getQtyIncrements ' ])
32
32
->getMock ();
33
33
34
34
$ this ->stockRegistry = $ this ->getMockBuilder (\Magento \CatalogInventory \Api \StockRegistryInterface::class)
@@ -74,7 +74,7 @@ public function testAfterGetQuantityValidators()
74
74
->with ('productId ' , 'websiteId ' )
75
75
->willReturn ($ this ->stockItem );
76
76
$ this ->stockItem ->expects ($ this ->once ())->method ('getMinSaleQty ' )->willReturn (0.5 );
77
- $ this ->stockItem ->expects ($ this ->any ())->method ('getQtyMaxAllowed ' )->willReturn (5 );
77
+ $ this ->stockItem ->expects ($ this ->any ())->method ('getMaxSaleQty ' )->willReturn (5 );
78
78
$ this ->stockItem ->expects ($ this ->any ())->method ('getQtyIncrements ' )->willReturn (3 );
79
79
80
80
$ this ->assertEquals ($ result , $ this ->block ->afterGetQuantityValidators ($ productViewBlock , $ validators ));
Original file line number Diff line number Diff line change @@ -910,6 +910,7 @@ define([
910
910
'validate-item-quantity' : [
911
911
function ( value , params ) {
912
912
var validator = this ,
913
+ result = false ,
913
914
// obtain values for validation
914
915
qty = utils . parseNumber ( value ) ,
915
916
isMinAllowedValid = typeof params . minAllowed === 'undefined' ||
@@ -919,15 +920,15 @@ define([
919
920
isQtyIncrementsValid = typeof params . qtyIncrements === 'undefined' ||
920
921
qty % utils . parseNumber ( params . qtyIncrements ) === 0 ;
921
922
922
- var result = qty > 0 ;
923
+ result = qty > 0 ;
923
924
924
925
if ( result === false ) {
925
926
validator . itemQtyErrorMessage = $ . mage . __ ( "Please enter a quantity greater than 0." ) ; //eslint-disable-line max-len
926
927
927
928
return result ;
928
929
}
929
930
930
- var result = isMinAllowedValid ;
931
+ result = isMinAllowedValid ;
931
932
932
933
if ( result === false ) {
933
934
validator . itemQtyErrorMessage = $ . mage . __ ( "The fewest you may purchase is %1." ) . replace ( '%1' , params . minAllowed ) ; //eslint-disable-line max-len
Original file line number Diff line number Diff line change 1567
1567
'validate-item-quantity' : [
1568
1568
function ( value , element , params ) {
1569
1569
var validator = this ,
1570
+ result = false ,
1570
1571
// obtain values for validation
1571
1572
qty = $ . mage . parseNumber ( value ) ,
1572
1573
isMinAllowedValid = typeof params . minAllowed === 'undefined' ||
1576
1577
isQtyIncrementsValid = typeof params . qtyIncrements === 'undefined' ||
1577
1578
qty % $ . mage . parseNumber ( params . qtyIncrements ) === 0 ;
1578
1579
1579
- var result = qty > 0 ;
1580
+ result = qty > 0 ;
1580
1581
1581
1582
if ( result === false ) {
1582
1583
validator . itemQtyErrorMessage = $ . mage . __ ( "Please enter a quantity greater than 0." ) ; //eslint-disable-line max-len
1583
1584
1584
1585
return result ;
1585
1586
}
1586
1587
1587
- var result = isMinAllowedValid ;
1588
+ result = isMinAllowedValid ;
1588
1589
1589
1590
if ( result === false ) {
1590
1591
validator . itemQtyErrorMessage = $ . mage . __ ( "The fewest you may purchase is %1." ) . replace ( '%1' , params . minAllowed ) ; //eslint-disable-line max-len
You can’t perform that action at this time.
0 commit comments