Skip to content

Commit b812fd7

Browse files
merge magento/2.3-develop into magento-mpi/MAGETWO-99161
2 parents 2d1f8ca + f961447 commit b812fd7

File tree

46 files changed

+813
-169
lines changed

Some content is hidden

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

46 files changed

+813
-169
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Fields marked with (*) are required. Please don't remove the template.
1111

1212
### Preconditions (*)
1313
<!---
14-
Provide the exact Magento version (example: 2.2.5) and any important information on the environment where bug is reproducible.
14+
Provide the exact Magento version (example: 2.3.2) and any important information on the environment where bug is reproducible.
1515
-->
1616
1.
1717
2.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a
99

1010
## Install Magento
1111

12-
* [Installation Guide](https://devdocs.magento.com/guides/v2.3/install-gde/bk-install-guide.html).
12+
* [Installation Guide](https://devdocs.magento.com/guides/v2.3/install-gde/bk-install-guide.html).
1313

1414
## Learn More About GraphQL in Magento 2
1515

@@ -18,7 +18,7 @@ Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a
1818
<h2>Contributing to the Magento 2 Code Base</h2>
1919
Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations, or just good suggestions.
2020

21-
To learn about how to make a contribution, click [here][1].
21+
To learn about how to contribute, click [here][1].
2222

2323
To learn about issues, click [here][2]. To open an issue, click [here][3].
2424

@@ -37,7 +37,7 @@ The members of this team have been recognized for their outstanding commitment t
3737
</a>
3838

3939
<h3>Top Contributors</h3>
40-
Magento is thankful for any contribution that can improve our code base, documentation or increase test coverage. We always recognize our most active members, as their contributions are the foundation of the Magento Open Source platform.
40+
Magento is thankful for any contribution that can improve our codebase, documentation or increase test coverage. We always recognize our most active members, as their contributions are the foundation of the Magento Open Source platform.
4141
<a href="https://magento.com/magento-contributors">
4242
<img src="https://github.com/raw/wiki/magento/magento2/images/contributors.png"/>
4343
</a>
@@ -48,7 +48,7 @@ Please review the [Code Contributions guide](https://devdocs.magento.com/guides/
4848

4949
## Reporting Security Issues
5050

51-
To report security vulnerabilities or learn more about reporting security issues in Magento software or web sites visit the [Magento Bug Bounty Program](https://hackerone.com/magento) on hackerone. Please create a hackerone account [there](https://hackerone.com/magento) to submit and follow-up your issue.
51+
To report security vulnerabilities or learn more about reporting security issues in Magento software or web sites visit the [Magento Bug Bounty Program](https://hackerone.com/magento) on hackerone. Please create a hackerone account [there](https://hackerone.com/magento) to submit and follow-up on your issue.
5252

5353
Stay up-to-date on the latest security news and patches for Magento by signing up for [Security Alert Notifications](https://magento.com/security/sign-up).
5454

@@ -64,7 +64,7 @@ Please see LICENSE_EE.txt for the full text of the MEE License or visit https://
6464

6565
## Community Engineering Slack
6666

67-
To connect with Magento and the Community, join us on the [Magento Community Engineering Slack](https://magentocommeng.slack.com). If you are interested in joining Slack, or a specific channel, send us request at [[email protected]](mailto:[email protected]) or [self signup](https://tinyurl.com/engcom-slack).
67+
To connect with Magento and the Community, join us on the [Magento Community Engineering Slack](https://magentocommeng.slack.com). If you are interested in joining Slack, or a specific channel, send us a request at [[email protected]](mailto:[email protected]) or [self signup](https://tinyurl.com/engcom-slack).
6868

6969

7070
We have channels for each project. These channels are recommended for new members:

app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ public function export()
216216
if ($entityCollection->count() == 0) {
217217
break;
218218
}
219+
$entityCollection->clear();
219220
$exportData = $this->getExportData();
220221
foreach ($exportData as $dataRow) {
221222
$writer->writeRow($dataRow);

app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,35 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Backend\Block\Widget\Grid\Massaction;
89

10+
use Magento\Backend\Block\Template\Context;
11+
use Magento\Backend\Block\Widget;
12+
use Magento\Backend\Block\Widget\Grid\Column;
13+
use Magento\Backend\Block\Widget\Grid\ColumnSet;
914
use Magento\Backend\Block\Widget\Grid\Massaction\VisibilityCheckerInterface as VisibilityChecker;
1015
use Magento\Framework\Data\Collection\AbstractDb;
1116
use Magento\Framework\DataObject;
17+
use Magento\Framework\DB\Select;
18+
use Magento\Framework\Json\EncoderInterface;
19+
use Magento\Quote\Model\Quote;
1220

1321
/**
1422
* Grid widget massaction block
1523
*
24+
* phpcs:disable Magento2.Classes.AbstractApi
1625
* @api
17-
* @method \Magento\Quote\Model\Quote setHideFormElement(boolean $value) Hide Form element to prevent IE errors
26+
* @method Quote setHideFormElement(boolean $value) Hide Form element to prevent IE errors
1827
* @method boolean getHideFormElement()
1928
* @deprecated 100.2.0 in favour of UI component implementation
2029
* @since 100.0.2
2130
*/
22-
abstract class AbstractMassaction extends \Magento\Backend\Block\Widget
31+
abstract class AbstractMassaction extends Widget
2332
{
2433
/**
25-
* @var \Magento\Framework\Json\EncoderInterface
34+
* @var EncoderInterface
2635
*/
2736
protected $_jsonEncoder;
2837

@@ -39,13 +48,13 @@ abstract class AbstractMassaction extends \Magento\Backend\Block\Widget
3948
protected $_template = 'Magento_Backend::widget/grid/massaction.phtml';
4049

4150
/**
42-
* @param \Magento\Backend\Block\Template\Context $context
43-
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
51+
* @param Context $context
52+
* @param EncoderInterface $jsonEncoder
4453
* @param array $data
4554
*/
4655
public function __construct(
47-
\Magento\Backend\Block\Template\Context $context,
48-
\Magento\Framework\Json\EncoderInterface $jsonEncoder,
56+
Context $context,
57+
EncoderInterface $jsonEncoder,
4958
array $data = []
5059
) {
5160
$this->_jsonEncoder = $jsonEncoder;
@@ -122,11 +131,7 @@ private function isVisible(DataObject $item)
122131
*/
123132
public function getItem($itemId)
124133
{
125-
if (isset($this->_items[$itemId])) {
126-
return $this->_items[$itemId];
127-
}
128-
129-
return null;
134+
return $this->_items[$itemId] ?? null;
130135
}
131136

132137
/**
@@ -161,7 +166,7 @@ public function getItemsJson()
161166
*/
162167
public function getCount()
163168
{
164-
return sizeof($this->_items);
169+
return count($this->_items);
165170
}
166171

167172
/**
@@ -288,11 +293,11 @@ public function getGridIdsJson()
288293

289294
if ($collection instanceof AbstractDb) {
290295
$idsSelect = clone $collection->getSelect();
291-
$idsSelect->reset(\Magento\Framework\DB\Select::ORDER);
292-
$idsSelect->reset(\Magento\Framework\DB\Select::LIMIT_COUNT);
293-
$idsSelect->reset(\Magento\Framework\DB\Select::LIMIT_OFFSET);
294-
$idsSelect->reset(\Magento\Framework\DB\Select::COLUMNS);
295-
$idsSelect->columns($this->getMassactionIdField(), 'main_table');
296+
$idsSelect->reset(Select::ORDER);
297+
$idsSelect->reset(Select::LIMIT_COUNT);
298+
$idsSelect->reset(Select::LIMIT_OFFSET);
299+
$idsSelect->reset(Select::COLUMNS);
300+
$idsSelect->columns($this->getMassactionIdField());
296301
$idList = $collection->getConnection()->fetchCol($idsSelect);
297302
} else {
298303
$idList = $collection->setPageSize(0)->getColumnValues($this->getMassactionIdField());
@@ -358,7 +363,7 @@ public function prepareMassactionColumn()
358363
{
359364
$columnId = 'massaction';
360365
$massactionColumn = $this->getLayout()->createBlock(
361-
\Magento\Backend\Block\Widget\Grid\Column::class
366+
Column::class
362367
)->setData(
363368
[
364369
'index' => $this->getMassactionIdField(),
@@ -378,7 +383,7 @@ public function prepareMassactionColumn()
378383
$gridBlock = $this->getParentBlock();
379384
$massactionColumn->setSelected($this->getSelected())->setGrid($gridBlock)->setId($columnId);
380385

381-
/** @var $columnSetBlock \Magento\Backend\Block\Widget\Grid\ColumnSet */
386+
/** @var $columnSetBlock ColumnSet */
382387
$columnSetBlock = $gridBlock->getColumnSet();
383388
$childNames = $columnSetBlock->getChildNames();
384389
$siblingElement = count($childNames) ? current($childNames) : 0;

app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/MassactionTest.php

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

7-
/**
8-
* Test class for \Magento\Backend\Block\Widget\Grid\Massaction
9-
*/
107
namespace Magento\Backend\Test\Unit\Block\Widget\Grid;
118

129
use Magento\Backend\Block\Widget\Grid\Massaction\VisibilityCheckerInterface as VisibilityChecker;
1310
use Magento\Framework\Authorization;
11+
use Magento\Framework\Data\Collection\AbstractDb as Collection;
12+
use Magento\Framework\DB\Adapter\AdapterInterface;
13+
use Magento\Framework\DB\Select;
1414

15+
/**
16+
* Test class for \Magento\Backend\Block\Widget\Grid\Massaction
17+
*
18+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
19+
*/
1520
class MassactionTest extends \PHPUnit\Framework\TestCase
1621
{
1722
/**
@@ -54,6 +59,21 @@ class MassactionTest extends \PHPUnit\Framework\TestCase
5459
*/
5560
private $visibilityCheckerMock;
5661

62+
/**
63+
* @var Collection|\PHPUnit\Framework\MockObject\MockObject
64+
*/
65+
private $gridCollectionMock;
66+
67+
/**
68+
* @var Select|\PHPUnit\Framework\MockObject\MockObject
69+
*/
70+
private $gridCollectionSelectMock;
71+
72+
/**
73+
* @var AdapterInterface|\PHPUnit\Framework\MockObject\MockObject
74+
*/
75+
private $connectionMock;
76+
5777
protected function setUp()
5878
{
5979
$this->_gridMock = $this->getMockBuilder(\Magento\Backend\Block\Widget\Grid::class)
@@ -97,6 +117,18 @@ protected function setUp()
97117
->setMethods(['isAllowed'])
98118
->getMock();
99119

120+
$this->gridCollectionMock = $this->createMock(Collection::class);
121+
$this->gridCollectionSelectMock = $this->createMock(Select::class);
122+
$this->connectionMock = $this->createMock(AdapterInterface::class);
123+
124+
$this->gridCollectionMock->expects($this->any())
125+
->method('getSelect')
126+
->willReturn($this->gridCollectionSelectMock);
127+
128+
$this->gridCollectionMock->expects($this->any())
129+
->method('getConnection')
130+
->willReturn($this->connectionMock);
131+
100132
$arguments = [
101133
'layout' => $this->_layoutMock,
102134
'request' => $this->_requestMock,
@@ -269,6 +301,41 @@ public function testGetGridIdsJsonWithoutUseSelectAll()
269301
$this->assertEmpty($this->_block->getGridIdsJson());
270302
}
271303

304+
/**
305+
* Test for getGridIdsJson when select all functionality flag set to true.
306+
*/
307+
public function testGetGridIdsJsonWithUseSelectAll()
308+
{
309+
$this->_block->setUseSelectAll(true);
310+
311+
$this->_gridMock->expects($this->once())
312+
->method('getCollection')
313+
->willReturn($this->gridCollectionMock);
314+
315+
$this->gridCollectionSelectMock->expects($this->exactly(4))
316+
->method('reset')
317+
->withConsecutive(
318+
[Select::ORDER],
319+
[Select::LIMIT_COUNT],
320+
[Select::LIMIT_OFFSET],
321+
[Select::COLUMNS]
322+
);
323+
324+
$this->gridCollectionSelectMock->expects($this->once())
325+
->method('columns')
326+
->with('test_id');
327+
328+
$this->connectionMock->expects($this->once())
329+
->method('fetchCol')
330+
->with($this->gridCollectionSelectMock)
331+
->willReturn([1, 2, 3]);
332+
333+
$this->assertEquals(
334+
'1,2,3',
335+
$this->_block->getGridIdsJson()
336+
);
337+
}
338+
272339
/**
273340
* @param string $itemId
274341
* @param array|\Magento\Framework\DataObject $item

app/code/Magento/Checkout/view/frontend/templates/button.phtml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
<?php /** @var $block \Magento\Checkout\Block\Onepage\Success */ ?>
88

99
<?php if ($block->getCanViewOrder() && $block->getCanPrintOrder()) :?>
10-
<a href="<?= $block->escapeUrl($block->getPrintUrl()) ?>" target="_blank" class="print">
10+
<a href="<?= $block->escapeUrl($block->getPrintUrl()) ?>"
11+
class="action print"
12+
target="_blank"
13+
rel="noopener">
1114
<?= $block->escapeHtml(__('Print receipt')) ?>
1215
</a>
1316
<?= $block->getChildHtml() ?>

app/code/Magento/Checkout/view/frontend/web/js/model/cart/estimate-service.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ define([
1313
], function (quote, defaultProcessor, totalsDefaultProvider, shippingService, cartCache, customerData) {
1414
'use strict';
1515

16-
var rateProcessors = [],
17-
totalsProcessors = [],
16+
var rateProcessors = {},
17+
totalsProcessors = {},
1818

1919
/**
2020
* Estimate totals for shipping address and update shipping rates.

app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rate-service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ define([
1010
], function (quote, defaultProcessor, customerAddressProcessor) {
1111
'use strict';
1212

13-
var processors = [];
13+
var processors = {};
1414

1515
processors.default = defaultProcessor;
1616
processors['customer-address'] = customerAddressProcessor;

app/code/Magento/Checkout/view/frontend/web/js/model/shipping-save-processor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ define([
1111
], function (defaultProcessor) {
1212
'use strict';
1313

14-
var processors = [];
14+
var processors = {};
1515

1616
processors['default'] = defaultProcessor;
1717

app/code/Magento/ConfigurableProduct/Model/Product/Type/VariationMatrix.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\ConfigurableProduct\Model\Product\Type;
78

89
/**
10+
* Variation matrix.
11+
*
912
* @api
1013
* @since 100.0.2
1114
*/
@@ -40,7 +43,9 @@ public function getVariations($usedProductAttributes)
4043
for ($attributeIndex = $attributesCount; $attributeIndex--;) {
4144
$currentAttribute = $variationalAttributes[$attributeIndex];
4245
$currentVariationValue = $currentVariation[$attributeIndex];
43-
$filledVariation[$currentAttribute['id']] = $currentAttribute['values'][$currentVariationValue];
46+
if (!empty($currentAttribute['id'])) {
47+
$filledVariation[$currentAttribute['id']] = $currentAttribute['values'][$currentVariationValue];
48+
}
4449
}
4550

4651
$variations[] = $filledVariation;

0 commit comments

Comments
 (0)