Skip to content

Commit 723039c

Browse files
committed
Merge branch '2.3-develop' into graphQl-509
2 parents 5ad9605 + db0dce6 commit 723039c

File tree

61 files changed

+1893
-391
lines changed

Some content is hidden

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

61 files changed

+1893
-391
lines changed

app/code/Magento/Analytics/Model/ExportDataHandler.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function __construct(
8989
public function prepareExportData()
9090
{
9191
try {
92-
$tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::SYS_TMP);
92+
$tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
9393

9494
$this->prepareDirectory($tmpDirectory, $this->getTmpFilesDirRelativePath());
9595
$this->reportWriter->write($tmpDirectory, $this->getTmpFilesDirRelativePath());
@@ -157,7 +157,9 @@ private function prepareDirectory(WriteInterface $directory, $path)
157157
private function prepareFileDirectory(WriteInterface $directory, $path)
158158
{
159159
$directory->delete($path);
160+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
160161
if (dirname($path) !== '.') {
162+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
161163
$directory->create(dirname($path));
162164
}
163165

@@ -176,6 +178,7 @@ private function pack($source, $destination)
176178
$this->archive->pack(
177179
$source,
178180
$destination,
181+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
179182
is_dir($source) ?: false
180183
);
181184

app/code/Magento/Analytics/Test/Unit/Model/ExportDataHandlerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Magento\Framework\Archive;
1414
use Magento\Framework\Filesystem;
1515
use Magento\Framework\Filesystem\Directory\WriteInterface;
16-
use Magento\Framework\Filesystem\DirectoryList;
16+
use Magento\Framework\App\Filesystem\DirectoryList;
1717
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
1818

1919
class ExportDataHandlerTest extends \PHPUnit\Framework\TestCase
@@ -137,7 +137,7 @@ public function testPrepareExportData($isArchiveSourceDirectory)
137137
$this->filesystemMock
138138
->expects($this->once())
139139
->method('getDirectoryWrite')
140-
->with(DirectoryList::SYS_TMP)
140+
->with(DirectoryList::VAR_DIR)
141141
->willReturn($this->directoryMock);
142142
$this->directoryMock
143143
->expects($this->exactly(4))
@@ -238,7 +238,7 @@ public function testPrepareExportDataWithLocalizedException()
238238
$this->filesystemMock
239239
->expects($this->once())
240240
->method('getDirectoryWrite')
241-
->with(DirectoryList::SYS_TMP)
241+
->with(DirectoryList::VAR_DIR)
242242
->willReturn($this->directoryMock);
243243
$this->reportWriterMock
244244
->expects($this->once())

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@
323323
</field>
324324
<field id="port" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
325325
<label>Port (25)</label>
326-
<comment>For Windows server only.</comment>
326+
<validate>validate-digits validate-digits-range digits-range-0-65535</validate>
327+
<comment>Please enter at least 0 and at most 65535 (For Windows server only).</comment>
327328
</field>
328329
<field id="set_return_path" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1">
329330
<label>Set Return-Path</label>

app/code/Magento/Backend/view/adminhtml/requirejs-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
var config = {
77
map: {
88
'*': {
9-
'mediaUploader': 'Magento_Backend/js/media-uploader'
9+
'mediaUploader': 'Magento_Backend/js/media-uploader',
10+
'mage/translate': 'Magento_Backend/js/translate'
1011
}
1112
}
1213
};
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
/* eslint-disable strict */
7+
(function (factory) {
8+
if (typeof define === 'function' && define.amd) {
9+
define([
10+
'jquery',
11+
'mage/mage'
12+
], factory);
13+
} else {
14+
factory(jQuery);
15+
}
16+
}(function ($) {
17+
$.extend(true, $, {
18+
mage: {
19+
translate: (function () {
20+
/**
21+
* Key-value translations storage
22+
* @type {Object}
23+
* @private
24+
*/
25+
var _data = {};
26+
27+
/**
28+
* Add new translation (two string parameters) or several translations (object)
29+
*/
30+
this.add = function () {
31+
if (arguments.length > 1) {
32+
_data[arguments[0]] = arguments[1];
33+
} else if (typeof arguments[0] === 'object') {
34+
$.extend(_data, arguments[0]);
35+
}
36+
};
37+
38+
/**
39+
* Make a translation with parsing (to handle case when _data represents tuple)
40+
* @param {String} text
41+
* @return {String}
42+
*/
43+
this.translate = function (text) {
44+
return _data[text] ? _data[text] : text;
45+
};
46+
47+
return this;
48+
}())
49+
}
50+
});
51+
$.mage.__ = $.proxy($.mage.translate.translate, $.mage.translate);
52+
53+
return $.mage.__;
54+
}));
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# BraintreeGraphQl
1+
# Magento_BraintreeGraphQl module
22

3-
**BraintreeGraphQl** provides type and resolver for method additional
4-
information.
3+
The Magento_BraintreeGraphQl module provides type and resolver information for the GraphQL module to pass payment information data from the client to Magento.
4+
5+
## Extensibility
6+
7+
Extension developers can interact with the Magento_BraintreeGraphQl module. For more information about the Magento extension mechanism, see [Magento plug-ins](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html).
8+
9+
[The Magento dependency injection mechanism](https://devdocs.magento.com/guides/v2.3/extension-dev-guide/depend-inj.html) enables you to override the functionality of the Magento_BraintreeGraphQl module.

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/PriceRange.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,16 @@ public function resolve(
6262
$product = $value['model'];
6363
$product->unsetData('minimal_price');
6464

65-
return [
66-
'minimum_price' => $this->getMinimumProductPrice($product, $store),
67-
'maximum_price' => $this->getMaximumProductPrice($product, $store)
68-
];
65+
$requestedFields = $info->getFieldSelection(10);
66+
$returnArray = [];
67+
68+
if (isset($requestedFields['minimum_price'])) {
69+
$returnArray['minimum_price'] = $this->getMinimumProductPrice($product, $store);
70+
}
71+
if (isset($requestedFields['maximum_price'])) {
72+
$returnArray['maximum_price'] = $this->getMaximumProductPrice($product, $store);
73+
}
74+
return $returnArray;
6975
}
7076

7177
/**
@@ -80,8 +86,9 @@ private function getMinimumProductPrice(SaleableInterface $product, StoreInterfa
8086
$priceProvider = $this->priceProviderPool->getProviderByProductType($product->getTypeId());
8187
$regularPrice = $priceProvider->getMinimalRegularPrice($product)->getValue();
8288
$finalPrice = $priceProvider->getMinimalFinalPrice($product)->getValue();
83-
84-
return $this->formatPrice($regularPrice, $finalPrice, $store);
89+
$minPriceArray = $this->formatPrice($regularPrice, $finalPrice, $store);
90+
$minPriceArray['model'] = $product;
91+
return $minPriceArray;
8592
}
8693

8794
/**
@@ -96,8 +103,9 @@ private function getMaximumProductPrice(SaleableInterface $product, StoreInterfa
96103
$priceProvider = $this->priceProviderPool->getProviderByProductType($product->getTypeId());
97104
$regularPrice = $priceProvider->getMaximalRegularPrice($product)->getValue();
98105
$finalPrice = $priceProvider->getMaximalFinalPrice($product)->getValue();
99-
100-
return $this->formatPrice($regularPrice, $finalPrice, $store);
106+
$maxPriceArray = $this->formatPrice($regularPrice, $finalPrice, $store);
107+
$maxPriceArray['model'] = $product;
108+
return $maxPriceArray;
101109
}
102110

103111
/**

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ type Price @doc(description: "Price is deprecated, replaced by ProductPrice. The
2121
adjustments: [PriceAdjustment] @deprecated(reason: "Price is deprecated, use ProductPrice.") @doc(description: "An array that provides information about tax, weee, or weee_tax adjustments.")
2222
}
2323

24-
type PriceAdjustment @doc(description: "The PricedAdjustment object defines the amount of money to apply as an adjustment, the type of adjustment to apply, and whether the item is included or excluded from the adjustment.") {
24+
type PriceAdjustment @doc(description: "PriceAdjustment is deprecated. Taxes will be included or excluded in the price. The PricedAdjustment object defines the amount of money to apply as an adjustment, the type of adjustment to apply, and whether the item is included or excluded from the adjustment.") {
2525
amount: Money @doc(description: "The amount of the price adjustment and its currency code.")
26-
code: PriceAdjustmentCodesEnum @doc(description: "Indicates whether the adjustment involves tax, weee, or weee_tax.")
27-
description: PriceAdjustmentDescriptionEnum @doc(description: "Indicates whether the entity described by the code attribute is included or excluded from the adjustment.")
26+
code: PriceAdjustmentCodesEnum @deprecated(reason: "PriceAdjustment is deprecated.") @doc(description: "Indicates whether the adjustment involves tax, weee, or weee_tax.")
27+
description: PriceAdjustmentDescriptionEnum @deprecated(reason: "PriceAdjustment is deprecated.") @doc(description: "Indicates whether the entity described by the code attribute is included or excluded from the adjustment.")
2828
}
2929

30-
enum PriceAdjustmentCodesEnum @doc(description: "Note: This enumeration contains values defined in modules other than the Catalog module.") {
30+
enum PriceAdjustmentCodesEnum @doc(description: "PriceAdjustment.code is deprecated. This enumeration contains values defined in modules other than the Catalog module.") {
3131
}
3232

33-
enum PriceAdjustmentDescriptionEnum @doc(description: "This enumeration states whether a price adjustment is included or excluded.") {
33+
enum PriceAdjustmentDescriptionEnum @doc(description: "PriceAdjustmentDescriptionEnum is deprecated. This enumeration states whether a price adjustment is included or excluded.") {
3434
INCLUDED
3535
EXCLUDED
3636
}

app/code/Magento/CatalogInventory/Model/Indexer/ProductPriceIndexFilter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ public function modifyPrice(IndexTableStructure $priceTable, array $entityIds =
104104
$select->where('stock_item.use_config_manage_stock = 0 AND stock_item.manage_stock = 1');
105105
}
106106

107+
if (!empty($entityIds)) {
108+
$select->where('stock_item.product_id in (?)', $entityIds);
109+
}
110+
107111
$select->group('stock_item.product_id');
108112
$select->having('max_is_in_stock = 0');
109113

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\CatalogInventory\Test\Unit\Model\Indexer;
8+
9+
use Magento\CatalogInventory\Api\StockConfigurationInterface;
10+
use Magento\CatalogInventory\Model\Indexer\ProductPriceIndexFilter;
11+
use Magento\CatalogInventory\Model\ResourceModel\Stock\Item;
12+
use Magento\Framework\App\ResourceConnection;
13+
use Magento\Framework\DB\Query\Generator;
14+
use PHPUnit\Framework\MockObject\MockObject;
15+
use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\IndexTableStructure;
16+
17+
/**
18+
* Product Price filter test, to ensure that product id's filtered.
19+
*/
20+
class ProductPriceIndexFilterTest extends \PHPUnit\Framework\TestCase
21+
{
22+
23+
/**
24+
* @var MockObject|StockConfigurationInterface $stockConfiguration
25+
*/
26+
private $stockConfiguration;
27+
28+
/**
29+
* @var MockObject|Item $item
30+
*/
31+
private $item;
32+
33+
/**
34+
* @var MockObject|ResourceConnection $resourceCnnection
35+
*/
36+
private $resourceCnnection;
37+
38+
/**
39+
* @var MockObject|Generator $generator
40+
*/
41+
private $generator;
42+
43+
/**
44+
* @var ProductPriceIndexFilter $productPriceIndexFilter
45+
*/
46+
private $productPriceIndexFilter;
47+
48+
/**
49+
* @inheritDoc
50+
*/
51+
protected function setUp()
52+
{
53+
$this->stockConfiguration = $this->createMock(StockConfigurationInterface::class);
54+
$this->item = $this->createMock(Item::class);
55+
$this->resourceCnnection = $this->createMock(ResourceConnection::class);
56+
$this->generator = $this->createMock(Generator::class);
57+
58+
$this->productPriceIndexFilter = new ProductPriceIndexFilter(
59+
$this->stockConfiguration,
60+
$this->item,
61+
$this->resourceCnnection,
62+
'indexer',
63+
$this->generator,
64+
100
65+
);
66+
}
67+
68+
/**
69+
* Test to ensure that Modify Price method uses entityIds,
70+
*/
71+
public function testModifyPrice()
72+
{
73+
$entityIds = [1, 2, 3];
74+
$indexTableStructure = $this->createMock(IndexTableStructure::class);
75+
$connectionMock = $this->createMock(\Magento\Framework\DB\Adapter\AdapterInterface::class);
76+
$this->resourceCnnection->expects($this->once())->method('getConnection')->willReturn($connectionMock);
77+
$selectMock = $this->createMock(\Magento\Framework\DB\Select::class);
78+
$connectionMock->expects($this->once())->method('select')->willReturn($selectMock);
79+
$selectMock->expects($this->at(2))
80+
->method('where')
81+
->with('stock_item.product_id in (?)', $entityIds)
82+
->willReturn($selectMock);
83+
$this->generator->expects($this->once())
84+
->method('generate')
85+
->will(
86+
$this->returnCallback(
87+
$this->getBatchIteratorCallback($selectMock, 5)
88+
)
89+
);
90+
91+
$fetchStmtMock = $this->createPartialMock(\Zend_Db_Statement_Pdo::class, ['fetchAll']);
92+
$fetchStmtMock->expects($this->any())
93+
->method('fetchAll')
94+
->will($this->returnValue([['product_id' => 1]]));
95+
$connectionMock->expects($this->any())->method('query')->will($this->returnValue($fetchStmtMock));
96+
$this->productPriceIndexFilter->modifyPrice($indexTableStructure, $entityIds);
97+
}
98+
99+
/**
100+
* Returns batches.
101+
*
102+
* @param MockObject $selectMock
103+
* @param int $batchCount
104+
* @return \Closure
105+
*/
106+
private function getBatchIteratorCallback(MockObject $selectMock, int $batchCount): \Closure
107+
{
108+
$iteratorCallback = function () use ($batchCount, $selectMock): array {
109+
$result = [];
110+
$count = $batchCount;
111+
while ($count) {
112+
$count--;
113+
$result[$count] = $selectMock;
114+
}
115+
116+
return $result;
117+
};
118+
119+
return $iteratorCallback;
120+
}
121+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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="AssertStorefrontCheckoutSuccessActionGroup">
12+
<annotations>
13+
<description>Verifies if the order is placed successfully on the 'one page checkout' page.</description>
14+
</annotations>
15+
<waitForElement selector="{{CheckoutSuccessMainSection.successTitle}}" stepKey="waitForLoadSuccessPageTitle"/>
16+
<waitForElement selector="{{CheckoutSuccessMainSection.success}}" time="30" stepKey="waitForLoadSuccessPage"/>
17+
<seeElement selector="{{CheckoutSuccessMainSection.orderLink}}" stepKey="seeOrderLink"/>
18+
</actionGroup>
19+
</actionGroups>
20+

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<element name="cartItemsAreaActive" type="textarea" selector="div.block.items-in-cart.active" timeout="30"/>
3232
<element name="checkMoneyOrderPayment" type="radio" selector="input#checkmo.radio" timeout="30"/>
3333
<element name="placeOrder" type="button" selector=".payment-method._active button.action.primary.checkout" timeout="30"/>
34-
<element name="paymentSectionTitle" type="text" selector="//*[@id='checkout-payment-method-load']//div[text()='Payment Method']" />
34+
<element name="paymentSectionTitle" type="text" selector="//*[@id='checkout-payment-method-load']//div[@data-role='title']" />
3535
<element name="orderSummarySubtotal" type="text" selector="//tr[@class='totals sub']//span[@class='price']" />
3636
<element name="orderSummaryShippingTotal" type="text" selector="//tr[@class='totals shipping excl']//span[@class='price']" />
3737
<element name="orderSummaryShippingMethod" type="text" selector="//tr[@class='totals shipping excl']//span[@class='value']" />

0 commit comments

Comments
 (0)