Skip to content

Commit ef24485

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-93830' into 2.3-develop-mftf-pr6
2 parents b26ed9b + 3b2e37e commit ef24485

File tree

69 files changed

+2036
-295
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2036
-295
lines changed

app/code/Magento/Bundle/Model/Product/Type.php

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
namespace Magento\Bundle\Model\Product;
88

9-
use Magento\Framework\App\ObjectManager;
9+
use Magento\Bundle\Model\ResourceModel\Selection\Collection as Selections;
10+
use Magento\Bundle\Model\ResourceModel\Selection\Collection\FilterApplier as SelectionCollectionFilterApplier;
1011
use Magento\Catalog\Api\ProductRepositoryInterface;
12+
use Magento\Framework\App\ObjectManager;
13+
use Magento\Framework\EntityManager\MetadataPool;
1114
use Magento\Framework\Pricing\PriceCurrencyInterface;
1215
use Magento\Framework\Serialize\Serializer\Json;
13-
use Magento\Framework\EntityManager\MetadataPool;
14-
use Magento\Bundle\Model\ResourceModel\Selection\Collection\FilterApplier as SelectionCollectionFilterApplier;
15-
use Magento\Bundle\Model\ResourceModel\Selection\Collection as Selections;
1616

1717
/**
1818
* Bundle Type Model
@@ -537,7 +537,7 @@ public function updateQtyOption($options, \Magento\Framework\DataObject $option,
537537
foreach ($options as $quoteItemOption) {
538538
if ($quoteItemOption->getCode() == 'selection_qty_' . $selection->getSelectionId()) {
539539
if ($optionUpdateFlag) {
540-
$quoteItemOption->setValue(intval($quoteItemOption->getValue()));
540+
$quoteItemOption->setValue((int) $quoteItemOption->getValue());
541541
} else {
542542
$quoteItemOption->setValue($value);
543543
}
@@ -625,6 +625,7 @@ public function isSalable($product)
625625

626626
/**
627627
* Prepare product and its configuration to be added to some products list.
628+
*
628629
* Perform standard preparation process and then prepare of bundle selections options.
629630
*
630631
* @param \Magento\Framework\DataObject $buyRequest
@@ -790,6 +791,8 @@ protected function _prepareProduct(\Magento\Framework\DataObject $buyRequest, $p
790791
}
791792

792793
/**
794+
* Cast array values to int
795+
*
793796
* @param array $array
794797
* @return int[]|int[][]
795798
*/
@@ -809,6 +812,8 @@ private function recursiveIntval(array $array)
809812
}
810813

811814
/**
815+
* Convert multi dimensional array to flat
816+
*
812817
* @param array $array
813818
* @return int[]
814819
*/
@@ -920,8 +925,7 @@ public function getOptionsByIds($optionIds, $product)
920925
}
921926

922927
/**
923-
* Prepare additional options/information for order item which will be
924-
* created from this product
928+
* Prepare additional options/information for order item which will be created from this product
925929
*
926930
* @param \Magento\Catalog\Model\Product $product
927931
* @return array
@@ -987,6 +991,7 @@ public function getOrderOptions($product)
987991

988992
/**
989993
* Sort selections method for usort function
994+
*
990995
* Sort selections by option position, selection position and selection id
991996
*
992997
* @param \Magento\Catalog\Model\Product $firstItem
@@ -1050,6 +1055,7 @@ public function getForceChildItemQtyChanges($product)
10501055

10511056
/**
10521057
* Retrieve additional searchable data from type instance
1058+
*
10531059
* Using based on product id and store_id data
10541060
*
10551061
* @param \Magento\Catalog\Model\Product $product
@@ -1118,6 +1124,7 @@ public function checkProductBuyState($product)
11181124

11191125
/**
11201126
* Retrieve products divided into groups required to purchase
1127+
*
11211128
* At least one product in each group has to be purchased
11221129
*
11231130
* @param \Magento\Catalog\Model\Product $product
@@ -1214,6 +1221,8 @@ public function getIdentities(\Magento\Catalog\Model\Product $product)
12141221
}
12151222

12161223
/**
1224+
* Returns selection qty
1225+
*
12171226
* @param \Magento\Framework\DataObject $selection
12181227
* @param int[] $qtys
12191228
* @param int $selectionOptionId
@@ -1232,6 +1241,8 @@ protected function getQty($selection, $qtys, $selectionOptionId)
12321241
}
12331242

12341243
/**
1244+
* Returns qty
1245+
*
12351246
* @param \Magento\Catalog\Model\Product $product
12361247
* @param \Magento\Framework\DataObject $selection
12371248
* @return float|int
@@ -1249,6 +1260,8 @@ protected function getBeforeQty($product, $selection)
12491260
}
12501261

12511262
/**
1263+
* Validate required options
1264+
*
12521265
* @param \Magento\Catalog\Model\Product $product
12531266
* @param bool $isStrictProcessMode
12541267
* @param \Magento\Bundle\Model\ResourceModel\Option\Collection $optionsCollection
@@ -1270,6 +1283,8 @@ protected function checkIsAllRequiredOptions($product, $isStrictProcessMode, $op
12701283
}
12711284

12721285
/**
1286+
* Check if selection is salable
1287+
*
12731288
* @param \Magento\Bundle\Model\ResourceModel\Selection\Collection $selections
12741289
* @param bool $skipSaleableCheck
12751290
* @param \Magento\Bundle\Model\ResourceModel\Option\Collection $optionsCollection
@@ -1300,6 +1315,8 @@ protected function checkSelectionsIsSale($selections, $skipSaleableCheck, $optio
13001315
}
13011316

13021317
/**
1318+
* Validate result
1319+
*
13031320
* @param array $_result
13041321
* @return void
13051322
* @throws \Magento\Framework\Exception\LocalizedException
@@ -1318,6 +1335,8 @@ protected function checkIsResult($_result)
13181335
}
13191336

13201337
/**
1338+
* Merge selections with options
1339+
*
13211340
* @param \Magento\Catalog\Model\Product\Option[] $options
13221341
* @param \Magento\Framework\DataObject[] $selections
13231342
* @return \Magento\Framework\DataObject[]
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminCreateApiDynamicBundleProductActionGroup">
12+
<!--Create 4 simple products-->
13+
<createData entity="SimpleProduct2" stepKey="simpleProduct1">
14+
<field key="price">4.99</field>
15+
</createData>
16+
<createData entity="SimpleProduct2" stepKey="simpleProduct2">
17+
<field key="price">2.89</field>
18+
</createData>
19+
<createData entity="SimpleProduct2" stepKey="simpleProduct3">
20+
<field key="price">7.33</field>
21+
</createData>
22+
<createData entity="SimpleProduct2" stepKey="simpleProduct4">
23+
<field key="price">18.25</field>
24+
</createData>
25+
<!-- Create the bundle product based -->
26+
<createData entity="ApiBundleProduct" stepKey="createBundleProduct"/>
27+
<createData entity="MultipleSelectOption" stepKey="createBundleOption1_1">
28+
<requiredEntity createDataKey="createBundleProduct"/>
29+
<field key="required">false</field>
30+
</createData>
31+
<createData entity="CheckboxOption" stepKey="createBundleOption1_2">
32+
<requiredEntity createDataKey="createBundleProduct"/>
33+
</createData>
34+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct">
35+
<requiredEntity createDataKey="createBundleProduct"/>
36+
<requiredEntity createDataKey="createBundleOption1_1"/>
37+
<requiredEntity createDataKey="simpleProduct1"/>
38+
</createData>
39+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct2">
40+
<requiredEntity createDataKey="createBundleProduct"/>
41+
<requiredEntity createDataKey="createBundleOption1_1"/>
42+
<requiredEntity createDataKey="simpleProduct2"/>
43+
</createData>
44+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct3">
45+
<requiredEntity createDataKey="createBundleProduct"/>
46+
<requiredEntity createDataKey="createBundleOption1_2"/>
47+
<requiredEntity createDataKey="simpleProduct3"/>
48+
</createData>
49+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct4">
50+
<requiredEntity createDataKey="createBundleProduct"/>
51+
<requiredEntity createDataKey="createBundleOption1_2"/>
52+
<requiredEntity createDataKey="simpleProduct4"/>
53+
</createData>
54+
</actionGroup>
55+
<actionGroup name="AdminCreateApiFixedBundleProductActionGroup">
56+
<!--Create 4 simple products-->
57+
<createData entity="SimpleProduct2" stepKey="simpleProduct1">
58+
<field key="price">4.99</field>
59+
</createData>
60+
<createData entity="SimpleProduct2" stepKey="simpleProduct2">
61+
<field key="price">2.89</field>
62+
</createData>
63+
<createData entity="SimpleProduct2" stepKey="simpleProduct3">
64+
<field key="price">7.33</field>
65+
</createData>
66+
<createData entity="SimpleProduct2" stepKey="simpleProduct4">
67+
<field key="price">18.25</field>
68+
</createData>
69+
<!-- Create the bundle product based -->
70+
<createData entity="ApiFixedBundleProduct" stepKey="createBundleProduct"/>
71+
<createData entity="MultipleSelectOption" stepKey="createBundleOption1_1">
72+
<requiredEntity createDataKey="createBundleProduct"/>
73+
<field key="required">false</field>
74+
</createData>
75+
<createData entity="CheckboxOption" stepKey="createBundleOption1_2">
76+
<requiredEntity createDataKey="createBundleProduct"/>
77+
</createData>
78+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct">
79+
<requiredEntity createDataKey="createBundleProduct"/>
80+
<requiredEntity createDataKey="createBundleOption1_1"/>
81+
<requiredEntity createDataKey="simpleProduct1"/>
82+
</createData>
83+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct2">
84+
<requiredEntity createDataKey="createBundleProduct"/>
85+
<requiredEntity createDataKey="createBundleOption1_1"/>
86+
<requiredEntity createDataKey="simpleProduct2"/>
87+
</createData>
88+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct3">
89+
<requiredEntity createDataKey="createBundleProduct"/>
90+
<requiredEntity createDataKey="createBundleOption1_2"/>
91+
<requiredEntity createDataKey="simpleProduct3"/>
92+
</createData>
93+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct4">
94+
<requiredEntity createDataKey="createBundleProduct"/>
95+
<requiredEntity createDataKey="createBundleOption1_2"/>
96+
<requiredEntity createDataKey="simpleProduct4"/>
97+
</createData>
98+
</actionGroup>
99+
</actionGroups>

app/code/Magento/Bundle/Test/Mftf/Data/ProductData.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,19 @@
6060
<requiredEntity type="custom_attribute">CustomAttributeDynamicPrice</requiredEntity>
6161
<requiredEntity type="custom_attribute">CustomAttributePriceViewRange</requiredEntity>
6262
</entity>
63+
<entity name="ApiFixedBundleProduct" type="product2">
64+
<data key="name" unique="suffix">Api Fixed Bundle Product</data>
65+
<data key="sku" unique="suffix">api-fixed-bundle-product</data>
66+
<data key="type_id">bundle</data>
67+
<data key="attribute_set_id">4</data>
68+
<data key="price">1.23</data>
69+
<data key="visibility">4</data>
70+
<data key="status">1</data>
71+
<data key="urlKey" unique="suffix">api-fixed-bundle-product</data>
72+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
73+
<requiredEntity type="custom_attribute">ApiProductDescription</requiredEntity>
74+
<requiredEntity type="custom_attribute">ApiProductShortDescription</requiredEntity>
75+
<requiredEntity type="custom_attribute">CustomAttributeFixPrice</requiredEntity>
76+
<requiredEntity type="custom_attribute">CustomAttributePriceView</requiredEntity>
77+
</entity>
6378
</entities>

app/code/Magento/Catalog/Block/Product/Widget/NewWidget.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function getCacheKeyInfo()
139139
[
140140
$this->getDisplayType(),
141141
$this->getProductsPerPage(),
142-
intval($this->getRequest()->getParam($this->getData('page_var_name'), 1)),
142+
(int) $this->getRequest()->getParam($this->getData('page_var_name'), 1),
143143
$this->serializer->serialize($this->getRequest()->getParams())
144144
]
145145
);

0 commit comments

Comments
 (0)