Skip to content

Commit 37c2de2

Browse files
merge magento/2.3-develop into magento-pangolin/MQE-1436
2 parents b4deccb + 741e610 commit 37c2de2

File tree

108 files changed

+2383
-519
lines changed

Some content is hidden

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

108 files changed

+2383
-519
lines changed

app/code/Magento/Backend/Block/Template/Context.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* the classes they were introduced for.
1818
*
1919
* @api
20+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2021
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2122
* @since 100.0.2
2223
*/
@@ -173,6 +174,8 @@ public function getAuthorization()
173174
}
174175

175176
/**
177+
* Get Backend Session
178+
*
176179
* @return \Magento\Backend\Model\Session
177180
*/
178181
public function getBackendSession()
@@ -181,6 +184,8 @@ public function getBackendSession()
181184
}
182185

183186
/**
187+
* Get Math Random
188+
*
184189
* @return \Magento\Framework\Math\Random
185190
*/
186191
public function getMathRandom()
@@ -189,6 +194,8 @@ public function getMathRandom()
189194
}
190195

191196
/**
197+
* Get Form Key
198+
*
192199
* @return \Magento\Framework\Data\Form\FormKey
193200
*/
194201
public function getFormKey()
@@ -197,7 +204,9 @@ public function getFormKey()
197204
}
198205

199206
/**
200-
* @return \Magento\Framework\Data\Form\FormKey
207+
* Get Class Name Builder
208+
*
209+
* @return \Magento\Framework\Code\NameBuilder
201210
*/
202211
public function getNameBuilder()
203212
{

app/code/Magento/Backup/Model/Backup.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* @method string getPath()
1515
* @method string getName()
1616
* @method string getTime()
17+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1718
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1819
* @api
1920
* @since 100.0.2
@@ -80,6 +81,7 @@ class Backup extends \Magento\Framework\DataObject implements \Magento\Framework
8081
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
8182
* @param \Magento\Framework\Filesystem $filesystem
8283
* @param array $data
84+
* @throws \Magento\Framework\Exception\FileSystemException
8385
*/
8486
public function __construct(
8587
\Magento\Backup\Helper\Data $helper,
@@ -242,7 +244,7 @@ public function setFile(&$content)
242244
/**
243245
* Return content of backup file
244246
*
245-
* @return string
247+
* @return array
246248
* @throws \Magento\Framework\Exception\LocalizedException
247249
*/
248250
public function &getFile()
@@ -275,8 +277,9 @@ public function deleteFile()
275277
*
276278
* @param bool $write
277279
* @return $this
278-
* @throws \Magento\Framework\Exception\InputException
279280
* @throws \Magento\Framework\Backup\Exception\NotEnoughPermissions
281+
* @throws \Magento\Framework\Exception\FileSystemException
282+
* @throws \Magento\Framework\Exception\InputException
280283
*/
281284
public function open($write = false)
282285
{
@@ -330,6 +333,7 @@ protected function _getStream()
330333
*
331334
* @param int $length
332335
* @return string
336+
* @throws \Magento\Framework\Exception\InputException
333337
*/
334338
public function read($length)
335339
{
@@ -340,6 +344,7 @@ public function read($length)
340344
* Check end of file.
341345
*
342346
* @return bool
347+
* @throws \Magento\Framework\Exception\InputException
343348
*/
344349
public function eof()
345350
{
@@ -370,6 +375,7 @@ public function write($string)
370375
* Close open backup file
371376
*
372377
* @return $this
378+
* @throws \Magento\Framework\Exception\InputException
373379
*/
374380
public function close()
375381
{
@@ -383,6 +389,8 @@ public function close()
383389
* Print output
384390
*
385391
* @return string
392+
* @return \Magento\Framework\Filesystem\Directory\ReadInterface|string|void
393+
* @throws \Magento\Framework\Exception\FileSystemException
386394
*/
387395
public function output()
388396
{
@@ -398,6 +406,8 @@ public function output()
398406
}
399407

400408
/**
409+
* Get Size
410+
*
401411
* @return int|mixed
402412
*/
403413
public function getSize()
@@ -419,6 +429,7 @@ public function getSize()
419429
*
420430
* @param string $password
421431
* @return bool
432+
* @throws \Exception
422433
*/
423434
public function validateUserPassword($password)
424435
{

app/code/Magento/CacheInvalidate/Model/PurgeCache.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ private function splitTags($tagsPattern)
118118
private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedTagsChunk)
119119
{
120120
$headers = [self::HEADER_X_MAGENTO_TAGS_PATTERN => $formattedTagsChunk];
121+
$unresponsiveServerError = [];
121122
foreach ($servers as $server) {
122123
$headers['Host'] = $server->getHost();
123124
try {
@@ -131,10 +132,30 @@ private function sendPurgeRequestToServers($socketAdapter, $servers, $formattedT
131132
$socketAdapter->read();
132133
$socketAdapter->close();
133134
} catch (\Exception $e) {
134-
$this->logger->critical($e->getMessage(), compact('server', 'formattedTagsChunk'));
135+
$unresponsiveServerError[] = "Cache host: " . $server->getHost() . ":" . $server->getPort() .
136+
"resulted in error message: " . $e->getMessage();
137+
}
138+
}
139+
140+
$errorCount = count($unresponsiveServerError);
141+
142+
if ($errorCount > 0) {
143+
$loggerMessage = implode(" ", $unresponsiveServerError);
144+
145+
if ($errorCount == count($servers)) {
146+
$this->logger->critical(
147+
'No cache server(s) could be purged ' . $loggerMessage,
148+
compact('server', 'formattedTagsChunk')
149+
);
135150
return false;
136151
}
152+
153+
$this->logger->warning(
154+
'Unresponsive cache server(s) hit' . $loggerMessage,
155+
compact('server', 'formattedTagsChunk')
156+
);
137157
}
158+
138159
$this->logger->execute(compact('servers', 'formattedTagsChunk'));
139160
return true;
140161
}

app/code/Magento/Catalog/Block/Product/View/Options.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/**
8-
* Product options block
9-
*
10-
* @author Magento Core Team <[email protected]>
11-
*/
127
namespace Magento\Catalog\Block\Product\View;
138

149
use Magento\Catalog\Model\Product;
10+
use Magento\Catalog\Model\Product\Option\Value;
1511

1612
/**
13+
* Product options block
14+
*
15+
* @author Magento Core Team <[email protected]>
1716
* @api
1817
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1918
* @since 100.0.2
@@ -121,6 +120,8 @@ public function setProduct(Product $product = null)
121120
}
122121

123122
/**
123+
* Get group of option.
124+
*
124125
* @param string $type
125126
* @return string
126127
*/
@@ -142,6 +143,8 @@ public function getOptions()
142143
}
143144

144145
/**
146+
* Check if block has options.
147+
*
145148
* @return bool
146149
*/
147150
public function hasOptions()
@@ -160,7 +163,10 @@ public function hasOptions()
160163
*/
161164
protected function _getPriceConfiguration($option)
162165
{
163-
$optionPrice = $this->pricingHelper->currency($option->getPrice(true), false, false);
166+
$optionPrice = $option->getPrice(true);
167+
if ($option->getPriceType() !== Value::TYPE_PERCENT) {
168+
$optionPrice = $this->pricingHelper->currency($optionPrice, false, false);
169+
}
164170
$data = [
165171
'prices' => [
166172
'oldPrice' => [
@@ -195,7 +201,7 @@ protected function _getPriceConfiguration($option)
195201
],
196202
],
197203
'type' => $option->getPriceType(),
198-
'name' => $option->getTitle()
204+
'name' => $option->getTitle(),
199205
];
200206
return $data;
201207
}
@@ -231,7 +237,7 @@ public function getJsonConfig()
231237
//pass the return array encapsulated in an object for the other modules to be able to alter it eg: weee
232238
$this->_eventManager->dispatch('catalog_product_option_price_configuration_after', ['configObj' => $configObj]);
233239

234-
$config=$configObj->getConfig();
240+
$config = $configObj->getConfig();
235241

236242
return $this->_jsonEncoder->encode($config);
237243
}

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

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,25 @@
241241
<click selector="{{AdminAddRelatedProductsModalSection.AddSelectedProductsButton}}" stepKey="addRelatedProductSelected"/>
242242
</actionGroup>
243243

244+
<!--Click AddCrossSellProducts and adds product by SKU-->
245+
<actionGroup name="addCrossSellProductBySku">
246+
<arguments>
247+
<argument name="sku"/>
248+
</arguments>
249+
<!--Scroll up to avoid error-->
250+
<scrollTo selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" x="0" y="-100" stepKey="scrollTo"/>
251+
<conditionalClick selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" dependentSelector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDependent}}" visible="false" stepKey="openDropDownIfClosedRelatedUpSellCrossSell"/>
252+
<click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddCrossSellProductsButton}}" stepKey="clickAddCrossSellButton"/>
253+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
254+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
255+
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/>
256+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
257+
<waitForPageLoad stepKey="waitForPageToLoad"/>
258+
<click selector="{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/>
259+
<click selector="{{AdminProductCrossSellModalSection.addSelectedProducts}}" stepKey="addRelatedProductSelected"/>
260+
<waitForPageLoad stepKey="waitForModalDisappear"/>
261+
</actionGroup>
262+
244263
<!--Add special price to product in Admin product page-->
245264
<actionGroup name="AddSpecialPriceToProductActionGroup">
246265
<arguments>
@@ -342,6 +361,32 @@
342361
</assertEquals>
343362
</actionGroup>
344363

364+
<!-- This action group goes to the product index page, opens the drop down and clicks the specified product type for adding a product -->
365+
<actionGroup name="GoToSpecifiedCreateProductPage">
366+
<arguments>
367+
<argument type="string" name="productType" defaultValue="simple"/>
368+
</arguments>
369+
<comment userInput="actionGroup:GoToSpecifiedCreateProductPage" stepKey="actionGroupComment"/>
370+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
371+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/>
372+
<click selector="{{AdminProductGridActionSection.addTypeProduct(productType)}}" stepKey="clickAddProduct"/>
373+
<waitForPageLoad stepKey="waitForFormToLoad"/>
374+
</actionGroup>
375+
376+
<!-- This action group simply navigates to the product catalog page -->
377+
<actionGroup name="GoToProductCatalogPage">
378+
<comment userInput="actionGroup:GoToProductCatalogPage" stepKey="actionGroupComment"/>
379+
<amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage"/>
380+
<waitForPageLoad stepKey="WaitForPageToLoad"/>
381+
</actionGroup>
382+
383+
<actionGroup name="SetProductUrlKey">
384+
<arguments>
385+
<argument name="product" defaultValue="_defaultProduct"/>
386+
</arguments>
387+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
388+
<fillField userInput="{{product.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
389+
</actionGroup>
345390
<actionGroup name="expandAdminProductSection">
346391
<arguments>
347392
<argument name="sectionSelector" defaultValue="{{AdminProductContentSection.sectionHeader}}" type="string"/>

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@
4545
<fillField selector="{{AdminProductAttributeSetSection.name}}" userInput="{{label}}" stepKey="fillName"/>
4646
<click selector="{{AdminProductAttributeSetSection.saveBtn}}" stepKey="clickSave1"/>
4747
</actionGroup>
48+
<actionGroup name="goToAttributeSetByName">
49+
<arguments>
50+
<argument name="name" type="string"/>
51+
</arguments>
52+
<click selector="{{AdminProductAttributeSetGridSection.resetFilter}}" stepKey="clickResetButton"/>
53+
<fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="{{name}}" stepKey="filterByName"/>
54+
<click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearch"/>
55+
<click selector="{{AdminProductAttributeSetGridSection.nthRow('1')}}" stepKey="clickFirstRow"/>
56+
<waitForPageLoad stepKey="waitForPageLoad"/>
57+
</actionGroup>
4858
<!-- Filter By Attribute Label -->
4959
<actionGroup name="filterProductAttributeByAttributeLabel">
5060
<arguments>

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,48 @@
115115
<data key="used_for_sort_by">true</data>
116116
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
117117
</entity>
118+
<entity name="newsFromDate" type="ProductAttribute">
119+
<data key="attribute_code">news_from_date</data>
120+
<data key="default_frontend_label">Set Product as New from Date</data>
121+
<data key="frontend_input">date</data>
122+
<data key="is_required">false</data>
123+
<data key="is_user_defined">true</data>
124+
<data key="scope">website</data>
125+
<data key="is_unique">false</data>
126+
<data key="is_searchable">false</data>
127+
<data key="is_visible">false</data>
128+
<data key="is_visible_on_front">false</data>
129+
<data key="is_filterable">false</data>
130+
<data key="is_filterable_in_search">false</data>
131+
<data key="used_in_product_listing">true</data>
132+
<data key="is_used_for_promo_rules">false</data>
133+
<data key="is_comparable">false</data>
134+
<data key="is_used_in_grid">true</data>
135+
<data key="is_filterable_in_grid">true</data>
136+
<data key="used_for_sort_by">false</data>
137+
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
138+
</entity>
139+
<entity name="newProductAttribute" type="ProductAttribute">
140+
<data key="attribute_code" unique="suffix">attribute</data>
141+
<data key="frontend_input">Text Field</data>
142+
<data key="scope">global</data>
143+
<data key="is_required">false</data>
144+
<data key="is_unique">false</data>
145+
<data key="is_searchable">true</data>
146+
<data key="is_visible">true</data>
147+
<data key="is_visible_in_advanced_search">true</data>
148+
<data key="is_visible_on_front">true</data>
149+
<data key="is_filterable">true</data>
150+
<data key="is_filterable_in_search">true</data>
151+
<data key="used_in_product_listing">true</data>
152+
<data key="is_used_for_promo_rules">true</data>
153+
<data key="is_comparable">true</data>
154+
<data key="is_used_in_grid">true</data>
155+
<data key="is_visible_in_grid">true</data>
156+
<data key="is_filterable_in_grid">true</data>
157+
<data key="used_for_sort_by">true</data>
158+
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
159+
</entity>
118160
<entity name="productYesNoAttribute" type="ProductAttribute">
119161
<data key="attribute_code" unique="suffix">attribute</data>
120162
<data key="frontend_input">boolean</data>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,9 @@
8181
<requiredEntity type="StoreLabel">Option9Store0</requiredEntity>
8282
<requiredEntity type="StoreLabel">Option10Store1</requiredEntity>
8383
</entity>
84+
<entity name="ProductAttributeOption8" type="ProductAttributeOption">
85+
<var key="attribute_code" entityKey="attribute_code" entityType="ProductAttribute"/>
86+
<data key="label" unique="suffix">White</data>
87+
<data key="value" unique="suffix">white</data>
88+
</entity>
8489
</entities>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminProductDeletePage" url="catalog/product/delete/id/{{productId}}/" area="admin" module="Magento_Catalog" parameterized="true">
12+
<!-- This page object only exists for the url. Use the AdminProductCreatePage for selectors. -->
13+
</page>
14+
</pages>

0 commit comments

Comments
 (0)