Skip to content

Commit d48d52f

Browse files
committed
Merge branch '2.4-develop' into MoveRecentlyViewedBundleFixedProductOnOrderPageTest
2 parents ef5cd8c + b7b5d58 commit d48d52f

File tree

1,314 files changed

+57516
-53495
lines changed

Some content is hidden

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

1,314 files changed

+57516
-53495
lines changed

Gruntfile.js.sample

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ module.exports = function (grunt) {
5252
prod: function (component) {
5353
var tasks = [
5454
'less',
55-
'autoprefixer',
5655
'cssmin',
5756
'usebanner'
5857
].map(function (task) {

app/bootstrap.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@
3030
exit(1);
3131
}
3232

33+
// PHP 8 compatibility. Define constants that are not present in PHP < 8.0
34+
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 80000) {
35+
if (!defined('T_NAME_QUALIFIED')) {
36+
define('T_NAME_QUALIFIED', 24001);
37+
}
38+
if (!defined('T_NAME_FULLY_QUALIFIED')) {
39+
define('T_NAME_FULLY_QUALIFIED', 24002);
40+
}
41+
}
42+
3343
require_once __DIR__ . '/autoload.php';
3444
// Sets default autoload mappings, may be overridden in Bootstrap::create
3545
\Magento\Framework\App\Bootstrap::populateAutoloader(BP, []);

app/code/Magento/AdminAnalytics/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"sort-packages": true
66
},
77
"require": {
8-
"php": "~7.3.0||~7.4.0",
8+
"php": "~7.4.0||~8.0.0",
99
"magento/framework": "*",
1010
"magento/module-backend": "*",
1111
"magento/module-config": "*",

app/code/Magento/AdminNotification/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"sort-packages": true
66
},
77
"require": {
8-
"php": "~7.3.0||~7.4.0",
8+
"php": "~7.4.0||~8.0.0",
99
"lib-libxml": "*",
1010
"magento/framework": "*",
1111
"magento/module-backend": "*",

app/code/Magento/AdvancedPricingImportExport/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"sort-packages": true
66
},
77
"require": {
8-
"php": "~7.3.0||~7.4.0",
8+
"php": "~7.4.0||~8.0.0",
99
"magento/framework": "*",
1010
"magento/module-catalog": "*",
1111
"magento/module-catalog-import-export": "*",

app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ public function __construct(
8080

8181
/**
8282
* Implementation of abstract construct
83+
*
8384
* @return void
8485
* @since 100.1.0
86+
* phpcs:disable Magento2.CodeAnalysis.EmptyBlock
8587
*/
8688
protected function _construct()
8789
{
@@ -118,7 +120,8 @@ protected function _getCatalogProductPriceData($productIds = null)
118120

119121
$result = [];
120122
foreach ($connection->fetchAll($catalogProductIndexPriceUnionSelect) as $row) {
121-
$result[$row['website_id']][$row['entity_id']][$row['customer_group_id']] = round($row['min_price'], 2);
123+
$result[$row['website_id']][$row['entity_id']][$row['customer_group_id']] =
124+
round((float) $row['min_price'], 2);
122125
}
123126

124127
return $result;

app/code/Magento/AdvancedSearch/Test/Unit/Model/ResourceModel/IndexTest.php

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ class IndexTest extends TestCase
6060
*/
6161
private $resourceConnectionMock;
6262

63+
/**
64+
* @inheritdoc
65+
*/
6366
protected function setUp(): void
6467
{
6568
$this->storeManagerMock = $this->getMockForAbstractClass(StoreManagerInterface::class);
@@ -98,6 +101,9 @@ protected function setUp(): void
98101
);
99102
}
100103

104+
/**
105+
* @return void
106+
*/
101107
public function testGetPriceIndexDataUsesFrontendPriceIndexerTable(): void
102108
{
103109
$storeId = 1;
@@ -117,4 +123,73 @@ public function testGetPriceIndexDataUsesFrontendPriceIndexerTable(): void
117123

118124
$this->assertEmpty($this->model->getPriceIndexData([1], $storeId));
119125
}
126+
127+
/**
128+
* @param array $testData
129+
* @dataProvider providerForTestPriceIndexData
130+
*
131+
* @return void
132+
*/
133+
public function testGetPriceIndexData(array $testData): void
134+
{
135+
$storeMock = $this->getMockForAbstractClass(StoreInterface::class);
136+
$storeMock->expects($this->any())->method('getId')->willReturn(1);
137+
$storeMock->method('getWebsiteId')->willReturn($testData['website_id']);
138+
$this->storeManagerMock->expects($this->once())
139+
->method('getStore')
140+
->with(1)->willReturn($storeMock);
141+
142+
$selectMock = $this->createMock(Select::class);
143+
$selectMock->expects($this->any())->method('union')->willReturnSelf();
144+
$this->adapterMock->expects($this->any())->method('select')->willReturn($selectMock);
145+
$this->adapterMock->expects($this->any())->method('fetchAll')->with($selectMock)->willReturn([$testData]);
146+
$expectedData = [
147+
$testData['entity_id'] => [
148+
$testData['customer_group_id'] => round((float) $testData['min_price'], 2)
149+
]
150+
];
151+
152+
$this->assertEquals($this->model->getPriceIndexData([1], 1), $expectedData);
153+
}
154+
155+
/**
156+
* @return array
157+
*/
158+
public function providerForTestPriceIndexData(): array
159+
{
160+
return [
161+
[
162+
[
163+
'website_id' => 1,
164+
'entity_id' => 1,
165+
'customer_group_id' => 1,
166+
'min_price' => '12.12'
167+
]
168+
],
169+
[
170+
[
171+
'website_id' => 1,
172+
'entity_id' => 2,
173+
'customer_group_id' => 2,
174+
'min_price' => null
175+
]
176+
],
177+
[
178+
[
179+
'website_id' => 1,
180+
'entity_id' => 3,
181+
'customer_group_id' => 3,
182+
'min_price' => 12.12
183+
]
184+
],
185+
[
186+
[
187+
'website_id' => 1,
188+
'entity_id' => 3,
189+
'customer_group_id' => 3,
190+
'min_price' => ''
191+
]
192+
]
193+
];
194+
}
120195
}

app/code/Magento/AdvancedSearch/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"magento/module-customer": "*",
1414
"magento/module-search": "*",
1515
"magento/module-store": "*",
16-
"php": "~7.3.0||~7.4.0"
16+
"php": "~7.4.0||~8.0.0"
1717
},
1818
"type": "magento2-module",
1919
"license": [

app/code/Magento/Amqp/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"magento/framework": "*",
99
"magento/framework-amqp": "*",
1010
"magento/framework-message-queue": "*",
11-
"php": "~7.3.0||~7.4.0"
11+
"php": "~7.4.0||~8.0.0"
1212
},
1313
"type": "magento2-module",
1414
"license": [

app/code/Magento/AmqpStore/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"magento/framework": "*",
99
"magento/framework-amqp": "*",
1010
"magento/module-store": "*",
11-
"php": "~7.3.0||~7.4.0"
11+
"php": "~7.4.0||~8.0.0"
1212
},
1313
"suggest": {
1414
"magento/module-asynchronous-operations": "*",

app/code/Magento/Analytics/Model/Config/Mapper.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ public function execute($configData)
5252
$providerData['parameters'] = !empty($providerData['parameters'])
5353
? reset($providerData['parameters'])
5454
: [];
55-
$providerData['parameters'] = array_map(
56-
'reset',
57-
$providerData['parameters']
58-
);
55+
array_walk($providerData['parameters'], function (&$array) {
56+
$array = reset($array);
57+
});
5958
$providers[$providerType] = $providerData;
6059
}
6160
$files[$fileData['name']] = $fileData;

app/code/Magento/Analytics/Test/Unit/ReportXml/SelectHydratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public function testRecreateWithExpression(
198198
->willReturn($this->selectMock);
199199
$withArgs = [];
200200

201-
foreach (array_keys($selectParts) as $key => $partName) {
201+
foreach (array_keys($selectParts) as $partName) {
202202
$withArgs[] = [$partName, $expectedParts[$partName]];
203203
}
204204
$this->selectMock

app/code/Magento/Analytics/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-analytics",
33
"description": "N/A",
44
"require": {
5-
"php": "~7.3.0||~7.4.0",
5+
"php": "~7.4.0||~8.0.0",
66
"magento/module-backend": "*",
77
"magento/module-config": "*",
88
"magento/module-integration": "*",
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\AsynchronousOperations\Cron;
9+
10+
use Magento\AsynchronousOperations\Api\Data\OperationInterface;
11+
use Magento\AsynchronousOperations\Model\ResourceModel\Operation;
12+
use Magento\Framework\Stdlib\DateTime\DateTime;
13+
14+
/**
15+
* Marks incomplete operations as failed
16+
*/
17+
class MarkIncompleteOperationsAsFailed
18+
{
19+
/**
20+
* Default message maximum processing time. Default to 12h
21+
*/
22+
private const DEFAULT_MESSAGE_MAX_PROCESSING_TIME = 43200;
23+
24+
/**
25+
* Default error code
26+
*/
27+
private const ERROR_CODE = 0;
28+
29+
/**
30+
* Default error message
31+
*/
32+
private const ERROR_MESSAGE = 'Unknown Error';
33+
34+
/**
35+
* @var Operation
36+
*/
37+
private $resource;
38+
39+
/**
40+
* @var DateTime
41+
*/
42+
private $dateTime;
43+
44+
/**
45+
* @var int
46+
*/
47+
private $messageMaxProcessingTime;
48+
49+
/**
50+
* @var string
51+
*/
52+
private $errorMessage;
53+
54+
/**
55+
* @var int
56+
*/
57+
private $errorCode;
58+
59+
/**
60+
* @var int
61+
*/
62+
private $failedStatus;
63+
64+
/**
65+
* @param Operation $resource
66+
* @param DateTime $dateTime
67+
* @param int $messageMaxProcessingTime
68+
* @param int $failedStatus
69+
* @param int $errorCode
70+
* @param string $errorMessage
71+
*/
72+
public function __construct(
73+
Operation $resource,
74+
DateTime $dateTime,
75+
int $messageMaxProcessingTime = self::DEFAULT_MESSAGE_MAX_PROCESSING_TIME,
76+
int $failedStatus = OperationInterface::STATUS_TYPE_RETRIABLY_FAILED,
77+
int $errorCode = self::ERROR_CODE,
78+
string $errorMessage = self::ERROR_MESSAGE
79+
) {
80+
$this->resource = $resource;
81+
$this->dateTime = $dateTime;
82+
$this->messageMaxProcessingTime = $messageMaxProcessingTime;
83+
$this->errorMessage = $errorMessage;
84+
$this->errorCode = $errorCode;
85+
$this->failedStatus = $failedStatus;
86+
}
87+
88+
/**
89+
* Marks incomplete operations as failed
90+
*/
91+
public function execute(): void
92+
{
93+
$connection = $this->resource->getConnection();
94+
$now = $this->dateTime->gmtTimestamp();
95+
$idField = $this->resource->getIdFieldName();
96+
$select = $connection->select()
97+
->from($this->resource->getMainTable(), [$idField])
98+
->where('status = ?', OperationInterface::STATUS_TYPE_OPEN)
99+
->where('started_at <= ?', $connection->formatDate($now - $this->messageMaxProcessingTime));
100+
101+
foreach ($connection->fetchCol($select) as $id) {
102+
$connection->update(
103+
$this->resource->getMainTable(),
104+
[
105+
'status' => $this->failedStatus,
106+
'result_message' => $this->errorMessage,
107+
'error_code' => $this->errorCode,
108+
],
109+
[
110+
"$idField = ?" => (int) $id
111+
]
112+
);
113+
}
114+
}
115+
}

0 commit comments

Comments
 (0)