Skip to content

Commit 3dffebe

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-gl/magento2ce into L3_Arrows_PR_20220209
2 parents 41e032c + 2d44647 commit 3dffebe

File tree

15 files changed

+216
-188
lines changed

15 files changed

+216
-188
lines changed

app/code/Magento/AsynchronousOperations/Model/BulkManagement.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,18 @@ public function __construct(
104104
*/
105105
public function scheduleBulk($bulkUuid, array $operations, $description, $userId = null)
106106
{
107-
$metadata = $this->metadataPool->getMetadata(BulkSummaryInterface::class);
108-
$connection = $this->resourceConnection->getConnectionByName($metadata->getEntityConnectionName());
109-
// save bulk summary and related operations
110-
$connection->beginTransaction();
111107
$userType = $this->userContext->getUserType();
112108
if ($userType === null) {
113109
$userType = UserContextInterface::USER_TYPE_ADMIN;
114110
}
111+
if ($userId === null && $userType === UserContextInterface::USER_TYPE_ADMIN) {
112+
$userId = $this->userContext->getUserId();
113+
}
114+
115+
$metadata = $this->metadataPool->getMetadata(BulkSummaryInterface::class);
116+
$connection = $this->resourceConnection->getConnectionByName($metadata->getEntityConnectionName());
117+
// save bulk summary and related operations
118+
$connection->beginTransaction();
115119
try {
116120
/** @var BulkSummaryInterface $bulkSummary */
117121
$bulkSummary = $this->bulkSummaryFactory->create();

app/code/Magento/MessageQueue/Setup/ConfigOptionsList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ public function getOptions()
6262
self::INPUT_KEY_QUEUE_DEFAULT_CONNECTION,
6363
TextConfigOption::FRONTEND_WIZARD_TEXT,
6464
self::CONFIG_PATH_QUEUE_DEFAULT_CONNECTION,
65-
'Message queues default connection. Can be db, amqp or a custom one.',
66-
self::DEFAULT_QUEUE_CONNECTION
65+
'Message queues default connection. Can be \'db\', \'amqp\' or a custom queue system.'
66+
. 'The queue system must be installed and configured, otherwise messages won\'t be processed correctly.'
6767
),
6868
];
6969
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"require-dev": {
8989
"allure-framework/allure-phpunit": "~1.5.0",
9090
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
91-
"friendsofphp/php-cs-fixer": "~3.3.0",
91+
"friendsofphp/php-cs-fixer": "~3.4.0",
9292
"lusitanian/oauth": "~0.8.10",
9393
"magento/magento-coding-standard": "*",
9494
"magento/magento2-functional-testing-framework": "^3.7",

composer.lock

Lines changed: 19 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tests/api-functional/config/post-install-setup-command-config.php.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ return [
1212
'config' => [
1313
'--remote-storage-driver' => 'aws-s3',
1414
'--remote-storage-bucket' => 'myBucket',
15-
'--remote-storage-region' => 'us-east-1'
15+
'--remote-storage-region' => 'us-east-1',
1616
]
1717
]
1818
*/
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
return [
8+
\Magento\Framework\App\ResourceConnection::class,
9+
\Magento\Framework\Config\Scope::class,
10+
\Magento\Framework\ObjectManager\RelationsInterface::class,
11+
\Magento\Framework\ObjectManager\ConfigInterface::class,
12+
\Magento\Framework\Interception\DefinitionInterface::class,
13+
\Magento\Framework\ObjectManager\DefinitionInterface::class,
14+
\Magento\Framework\Session\Config::class,
15+
\Magento\Framework\ObjectManager\Config\Mapper\Dom::class,
16+
];

dev/tests/integration/etc/install-config-mysql.php.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ return [
2323
'amqp-port' => '5672',
2424
'amqp-user' => 'guest',
2525
'amqp-password' => 'guest',
26+
'consumers-wait-for-messages' => '0',
2627
];

dev/tests/integration/etc/post-install-setup-command-config.php.dist

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
// List of bin/magento setup CLI commands to run after setup:install
88
return [
9-
/*
109
[
1110
'command' => 'setup:config:set',
1211
'config' => [
12+
'--queue-default-connection' => 'db'
13+
/*
1314
'--remote-storage-driver' => 'aws-s3',
1415
'--remote-storage-bucket' => 'myBucket',
15-
'--remote-storage-region' => 'us-east-1',
16-
'--queue-default-connection' => 'db'
16+
'--remote-storage-region' => 'us-east-1'
17+
*/
1718
]
1819
]
19-
*/
2020
];

dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,17 @@ class ObjectManager extends \Magento\Framework\App\ObjectManager
2323
/**
2424
* @var array
2525
*/
26-
protected $persistedInstances = [
27-
\Magento\Framework\App\ResourceConnection::class,
28-
\Magento\Framework\Config\Scope::class,
29-
\Magento\Framework\ObjectManager\RelationsInterface::class,
30-
\Magento\Framework\ObjectManager\ConfigInterface::class,
31-
\Magento\Framework\Interception\DefinitionInterface::class,
32-
\Magento\Framework\ObjectManager\DefinitionInterface::class,
33-
\Magento\Framework\Session\Config::class,
34-
\Magento\Framework\ObjectManager\Config\Mapper\Dom::class,
35-
];
26+
protected $persistedInstances = [];
27+
28+
/**
29+
* Set list of instances that should be persistent.
30+
*
31+
* @param array $persistedInstances
32+
*/
33+
public function setPersistedInstances(array $persistedInstances): void
34+
{
35+
$this->persistedInstances = $persistedInstances;
36+
}
3637

3738
/**
3839
* Clear InstanceManager cache.

dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,11 @@
2323
class ObjectManagerFactory extends \Magento\Framework\App\ObjectManagerFactory
2424
{
2525
/**
26-
* Locator class name
27-
*
2826
* @var string
2927
*/
3028
protected $_locatorClassName = ObjectManager::class;
3129

3230
/**
33-
* Config class name
34-
*
3531
* @var string
3632
*/
3733
protected $_configClassName = \Magento\TestFramework\ObjectManager\Config::class;
@@ -80,6 +76,30 @@ public function restore(ObjectManager $objectManager, $directoryList, array $arg
8076
return $objectManager;
8177
}
8278

79+
/**
80+
* Read config from provided directory
81+
*
82+
* @param string $directory
83+
* @return array
84+
* @throws LocalizedException
85+
*/
86+
private function readCustomConfig(string $directory): array
87+
{
88+
$path = __DIR__ . '/../../../etc/di/' . $directory . '/';
89+
$files = glob($path . '*.php');
90+
91+
$data = [];
92+
foreach ($files as $file) {
93+
if (!is_readable($file)) {
94+
throw new LocalizedException(__("'%1' is not readable file.", $file));
95+
}
96+
$data[] = include $file;
97+
}
98+
$data = array_merge([], ...$data);
99+
100+
return $data;
101+
}
102+
83103
/**
84104
* Load primary config
85105
*
@@ -98,23 +118,25 @@ protected function _loadPrimaryConfig(DirectoryList $directoryList, $driverPool,
98118
'default_setup' => ['type' => ConnectionAdapter::class]
99119
]
100120
);
101-
$diPreferences = [];
102-
$diPreferencesPath = __DIR__ . '/../../../etc/di/preferences/';
103-
104-
$preferenceFiles = glob($diPreferencesPath . '*.php');
105-
106-
foreach ($preferenceFiles as $file) {
107-
if (!is_readable($file)) {
108-
throw new LocalizedException(__("'%1' is not readable file.", $file));
109-
}
110-
$diPreferences = array_replace($diPreferences, include $file);
111-
}
112-
121+
$diPreferences = $this->readCustomConfig('preferences');
113122
$this->_primaryConfigData['preferences'] = array_replace(
114123
$this->_primaryConfigData['preferences'],
115124
$diPreferences
116125
);
117126
}
118127
return $this->_primaryConfigData;
119128
}
129+
130+
/**
131+
* @inheritdoc
132+
*/
133+
public function create(array $arguments)
134+
{
135+
/** @var \Magento\TestFramework\ObjectManager $objectManager */
136+
$objectManager = parent::create($arguments);
137+
$persistedInstances = $this->readCustomConfig('persistedInstances');
138+
$objectManager->setPersistedInstances($persistedInstances);
139+
140+
return $objectManager;
141+
}
120142
}

0 commit comments

Comments
 (0)