Skip to content

Commit e96acf9

Browse files
committed
Merge branch '2.3-develop' of https://github.com/magento/magento2ce into MAGETWO-99592
2 parents e912e6b + 2ec065d commit e96acf9

File tree

95 files changed

+3651
-72
lines changed

Some content is hidden

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

95 files changed

+3651
-72
lines changed

app/code/Magento/Catalog/Model/Product/Option/Type/Select.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
/**
1212
* Catalog product option select type
13+
*
14+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1315
*/
1416
class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType
1517
{
@@ -30,23 +32,35 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType
3032
*/
3133
protected $string;
3234

35+
/**
36+
* @var array
37+
*/
38+
private $singleSelectionTypes;
39+
3340
/**
3441
* @param \Magento\Checkout\Model\Session $checkoutSession
3542
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
3643
* @param \Magento\Framework\Stdlib\StringUtils $string
3744
* @param \Magento\Framework\Escaper $escaper
3845
* @param array $data
46+
* @param array $singleSelectionTypes
3947
*/
4048
public function __construct(
4149
\Magento\Checkout\Model\Session $checkoutSession,
4250
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
4351
\Magento\Framework\Stdlib\StringUtils $string,
4452
\Magento\Framework\Escaper $escaper,
45-
array $data = []
53+
array $data = [],
54+
array $singleSelectionTypes = []
4655
) {
4756
$this->string = $string;
4857
$this->_escaper = $escaper;
4958
parent::__construct($checkoutSession, $scopeConfig, $data);
59+
60+
$this->singleSelectionTypes = $singleSelectionTypes ?: [
61+
'drop_down' => \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN,
62+
'radio' => \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO,
63+
];
5064
}
5165

5266
/**
@@ -310,10 +324,6 @@ public function getOptionSku($optionValue, $skuDelimiter)
310324
*/
311325
protected function _isSingleSelection()
312326
{
313-
$single = [
314-
\Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN,
315-
\Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO,
316-
];
317-
return in_array($this->getOption()->getType(), $single);
327+
return in_array($this->getOption()->getType(), $this->singleSelectionTypes, true);
318328
}
319329
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
9+
<actionGroup name="StorefrontAssertProductSpecialPriceOnProductPageActionGroup">
10+
<arguments>
11+
<argument name="product" type="entity"/>
12+
<argument name="specialPrice" type="string"/>
13+
</arguments>
14+
<amOnPage url="{{StorefrontProductPage.url(product.name)}}" stepKey="onFirstProductPage"/>
15+
<waitForPageLoad stepKey="waitForFirstProductPage"/>
16+
<grabTextFrom selector="{{StorefrontProductInfoMainSection.specialPriceValue}}" stepKey="grabProductSpecialPrice"/>
17+
<assertEquals actual="$grabProductSpecialPrice" expectedType="string" expected="{{specialPrice}}" stepKey="assertProductPriceValuesAreEqual"/>
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontProductPageActionGroup.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
2020
</actionGroup>
2121

22+
<actionGroup name="AddProductWithQtyToCartFromStorefrontProductPage" extends="addToCartFromStorefrontProductPage">
23+
<arguments>
24+
<argument name="productName" type="string"/>
25+
<argument name="productQty" type="string"/>
26+
</arguments>
27+
<fillField selector="{{StorefrontProductActionSection.quantity}}" userInput="{{productQty}}" stepKey="fillProductQuantity" before="addToCart"/>
28+
</actionGroup>
29+
2230
<!--Verify text length validation hint with multiple inputs-->
2331
<actionGroup name="testDynamicValidationHint">
2432
<arguments>

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

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,11 @@
481481
<var key="sku" entityType="product" entityKey="sku" />
482482
<requiredEntity type="product_option">ProductOptionValueDropdown</requiredEntity>
483483
</entity>
484+
<entity name="productWithDropdownAndFieldOptions" type="product">
485+
<var key="sku" entityType="product" entityKey="sku" />
486+
<requiredEntity type="product_option">ProductOptionValueDropdown</requiredEntity>
487+
<requiredEntity type="product_option">ProductOptionField</requiredEntity>
488+
</entity>
484489
<entity name="ProductWithTextFieldAndAreaOptions" type="product">
485490
<var key="sku" entityType="product" entityKey="sku" />
486491
<requiredEntity type="product_option">ProductOptionField</requiredEntity>
@@ -1069,4 +1074,74 @@
10691074
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
10701075
<requiredEntity type="custom_attribute_array">ApiProductDescription</requiredEntity>
10711076
</entity>
1077+
<entity name="SimpleProductWithSpecialPrice" type="product">
1078+
<data key="sku" unique="suffix">SimpleProductWithSpecialPrice</data>
1079+
<data key="type_id">simple</data>
1080+
<data key="attribute_set_id">4</data>
1081+
<data key="name" unique="suffix">SimpleProduct</data>
1082+
<data key="price">100.00</data>
1083+
<data key="special_price">90.00</data>
1084+
<data key="visibility">4</data>
1085+
<data key="status">1</data>
1086+
<data key="quantity">86</data>
1087+
<data key="urlKey" unique="suffix">simpleproduct</data>
1088+
<data key="weight">1</data>
1089+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
1090+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
1091+
</entity>
1092+
<entity name="SimpleProductWithSpecialPriceSecond" type="product">
1093+
<data key="sku" unique="suffix">SimpleProductWithSpecialPriceSecond</data>
1094+
<data key="type_id">simple</data>
1095+
<data key="attribute_set_id">4</data>
1096+
<data key="name" unique="suffix">SimpleProduct</data>
1097+
<data key="price">150.00</data>
1098+
<data key="special_price">110.00</data>
1099+
<data key="visibility">4</data>
1100+
<data key="status">1</data>
1101+
<data key="quantity">86</data>
1102+
<data key="urlKey" unique="suffix">simpleproduct</data>
1103+
<data key="weight">1</data>
1104+
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
1105+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
1106+
</entity>
1107+
<entity name="SimpleProduct_100" type="product">
1108+
<data key="sku" unique="suffix">testSku</data>
1109+
<data key="type_id">simple</data>
1110+
<data key="attribute_set_id">4</data>
1111+
<data key="visibility">4</data>
1112+
<data key="name" unique="suffix">testProductName</data>
1113+
<data key="price">100.00</data>
1114+
<data key="urlKey" unique="suffix">testurlkey</data>
1115+
<data key="status">1</data>
1116+
<data key="quantity">777</data>
1117+
<data key="weight">1</data>
1118+
<requiredEntity type="product_extension_attribute">EavStock777</requiredEntity>
1119+
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
1120+
</entity>
1121+
<entity name="ApiSimpleOneQty10" type="product2">
1122+
<data key="sku" unique="suffix">api-simple-product</data>
1123+
<data key="type_id">simple</data>
1124+
<data key="attribute_set_id">4</data>
1125+
<data key="visibility">4</data>
1126+
<data key="name" unique="suffix">Api Simple Product</data>
1127+
<data key="price">40.00</data>
1128+
<data key="urlKey" unique="suffix">api-simple-product</data>
1129+
<data key="status">1</data>
1130+
<data key="quantity">10</data>
1131+
<requiredEntity type="product_extension_attribute">EavStock10</requiredEntity>
1132+
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
1133+
</entity>
1134+
<entity name="ApiSimpleTwoQty10" type="product2">
1135+
<data key="sku" unique="suffix">api-simple-product-two</data>
1136+
<data key="type_id">simple</data>
1137+
<data key="attribute_set_id">4</data>
1138+
<data key="visibility">4</data>
1139+
<data key="name" unique="suffix">Api Simple Product Two</data>
1140+
<data key="price">40.00</data>
1141+
<data key="urlKey" unique="suffix">api-simple-product-two</data>
1142+
<data key="status">1</data>
1143+
<data key="quantity">10</data>
1144+
<requiredEntity type="product_extension_attribute">EavStock10</requiredEntity>
1145+
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
1146+
</entity>
10721147
</entities>

app/code/Magento/Catalog/Test/Mftf/Data/ProductExtensionAttributeData.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,7 @@
2020
<entity name="EavStock1" type="product_extension_attribute">
2121
<requiredEntity type="stock_item">Qty_1</requiredEntity>
2222
</entity>
23+
<entity name="EavStock777" type="product_extension_attribute">
24+
<requiredEntity type="stock_item">Qty_777</requiredEntity>
25+
</entity>
2326
</entities>

app/code/Magento/Catalog/Test/Mftf/Data/StockItemData.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,8 @@
3232
<data key="qty">1</data>
3333
<data key="is_in_stock">true</data>
3434
</entity>
35+
<entity name="Qty_777" type="stock_item">
36+
<data key="qty">777</data>
37+
<data key="is_in_stock">true</data>
38+
</entity>
3539
</entities>

app/code/Magento/Catalog/etc/di.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,4 +1165,12 @@
11651165
</argument>
11661166
</arguments>
11671167
</type>
1168+
<type name="Magento\Catalog\Model\Product\Option\Type\Select">
1169+
<arguments>
1170+
<argument name="singleSelectionTypes" xsi:type="array">
1171+
<item name="drop_down" xsi:type="const">Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN</item>
1172+
<item name="radio" xsi:type="const">Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO</item>
1173+
</argument>
1174+
</arguments>
1175+
</type>
11681176
</config>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertShoppingCartIsEmptyActionGroup">
11+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnPageShoppingCart"/>
12+
<waitForPageLoad stepKey="waitForCheckoutPageLoad"/>
13+
<see userInput="You have no items in your shopping cart." stepKey="seeNoItemsInShoppingCart"/>
14+
</actionGroup>
15+
</actionGroups>

app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontShoppingCartSummaryWithShippingActionGroup.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
</arguments>
1414
<waitForLoadingMaskToDisappear stepKey="waitForMaskToDisappear" after="assertSubtotal"/>
1515
<waitForElementVisible selector="{{CheckoutCartSummarySection.shipping}}" time="60" stepKey="waitForElementToBeVisible" after="waitForMaskToDisappear"/>
16-
<waitForText userInput="{{shipping}}" selector="{{CheckoutCartSummarySection.shipping}}" time="60" stepKey="assertShipping" after="waitForElementToBeVisible"/>
16+
<wait time="5" stepKey="waitForShippingDetailsToLoad" after="waitForElementToBeVisible"/>
17+
<waitForText userInput="{{shipping}}" selector="{{CheckoutCartSummarySection.shipping}}" time="120" stepKey="assertShipping" after="waitForShippingDetailsToLoad"/>
1718
</actionGroup>
1819
</actionGroups>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="CustomerCheckoutFillNewShippingAddressActionGroup">
12+
<arguments>
13+
<argument name="address" type="entity"/>
14+
</arguments>
15+
<selectOption selector="{{CheckoutShippingSection.country}}" userInput="{{address.country}}" stepKey="selectCounty"/>
16+
<fillField selector="{{CheckoutShippingSection.street}}" userInput="{{address.street}}" stepKey="fillStreet"/>
17+
<fillField selector="{{CheckoutShippingSection.city}}" userInput="{{address.city}}" stepKey="fillCity"/>
18+
<selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{address.state}}" stepKey="selectRegion"/>
19+
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{address.postcode}}" stepKey="fillZipCode"/>
20+
<fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{address.telephone}}" stepKey="fillPhone"/>
21+
<fillField selector="{{CheckoutShippingSection.company}}" userInput="{{address.company}}" stepKey="fillCompany"/>
22+
</actionGroup>
23+
</actionGroups>

0 commit comments

Comments
 (0)