Skip to content

Commit 0026a11

Browse files
committed
Merge remote-tracking branch 'upstream/2.4-develop' into 2.4-develop
2 parents a33d5b6 + ecaa3b7 commit 0026a11

File tree

244 files changed

+5273
-1462
lines changed

Some content is hidden

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

244 files changed

+5273
-1462
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class MassSchedule
5353
private $logger;
5454

5555
/**
56-
* @var OperationRepository
56+
* @var OperationRepositoryInterface
5757
*/
5858
private $operationRepository;
5959

@@ -75,7 +75,7 @@ class MassSchedule
7575
* @param AsyncResponseInterfaceFactory $asyncResponseFactory
7676
* @param BulkManagementInterface $bulkManagement
7777
* @param LoggerInterface $logger
78-
* @param OperationRepository $operationRepository
78+
* @param OperationRepositoryInterface $operationRepository
7979
* @param UserContextInterface $userContext
8080
* @param Encryptor $encryptor
8181
*/
@@ -85,7 +85,7 @@ public function __construct(
8585
AsyncResponseInterfaceFactory $asyncResponseFactory,
8686
BulkManagementInterface $bulkManagement,
8787
LoggerInterface $logger,
88-
OperationRepository $operationRepository,
88+
OperationRepositoryInterface $operationRepository,
8989
UserContextInterface $userContext,
9090
Encryptor $encryptor
9191
) {
@@ -137,7 +137,7 @@ public function publishMass($topicName, array $entitiesArray, $groupId = null, $
137137
$requestItem = $this->itemStatusInterfaceFactory->create();
138138

139139
try {
140-
$operation = $this->operationRepository->createByTopic($topicName, $entityParams, $groupId);
140+
$operation = $this->operationRepository->create($topicName, $entityParams, $groupId, $key);
141141
$operations[] = $operation;
142142
$requestItem->setId($key);
143143
$requestItem->setStatus(ItemStatusInterface::STATUS_ACCEPTED);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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\Model;
9+
10+
use Magento\AsynchronousOperations\Api\Data\OperationInterface;
11+
12+
/**
13+
* Repository interface to create operation
14+
*/
15+
interface OperationRepositoryInterface
16+
{
17+
/**
18+
* Create operation by topic, parameters and group ID
19+
*
20+
* @param string $topicName
21+
* @param array $entityParams
22+
* format: array(
23+
* '<arg1-name>' => '<arg1-value>',
24+
* '<arg2-name>' => '<arg2-value>',
25+
* )
26+
* @param string $groupId
27+
* @param int $operationId
28+
* @return OperationInterface
29+
*/
30+
public function create($topicName, $entityParams, $groupId, $operationId): OperationInterface;
31+
}

app/code/Magento/AsynchronousOperations/Model/ResourceModel/Operation/OperationRepository.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use Magento\AsynchronousOperations\Api\Data\OperationInterface;
1212
use Magento\AsynchronousOperations\Api\Data\OperationInterfaceFactory;
13+
use Magento\AsynchronousOperations\Model\OperationRepositoryInterface;
1314
use Magento\Framework\MessageQueue\MessageValidator;
1415
use Magento\Framework\MessageQueue\MessageEncoder;
1516
use Magento\Framework\Serialize\Serializer\Json;
@@ -18,10 +19,10 @@
1819
/**
1920
* Create operation for list of bulk operations.
2021
*/
21-
class OperationRepository
22+
class OperationRepository implements OperationRepositoryInterface
2223
{
2324
/**
24-
* @var \Magento\AsynchronousOperations\Api\Data\OperationInterfaceFactory
25+
* @var OperationInterfaceFactory
2526
*/
2627
private $operationFactory;
2728

@@ -67,10 +68,14 @@ public function __construct(
6768
}
6869

6970
/**
70-
* @param $topicName
71-
* @param $entityParams
72-
* @param $groupId
73-
* @return mixed
71+
* Create operation by topic, parameters and group ID
72+
*
73+
* @param string $topicName
74+
* @param array $entityParams
75+
* @param string $groupId
76+
* @return OperationInterface
77+
* @deprecated No longer used.
78+
* @see create()
7479
*/
7580
public function createByTopic($topicName, $entityParams, $groupId)
7681
{
@@ -91,8 +96,16 @@ public function createByTopic($topicName, $entityParams, $groupId)
9196
],
9297
];
9398

94-
/** @var \Magento\AsynchronousOperations\Api\Data\OperationInterface $operation */
99+
/** @var OperationInterface $operation */
95100
$operation = $this->operationFactory->create($data);
96101
return $this->entityManager->save($operation);
97102
}
103+
104+
/**
105+
* @inheritDoc
106+
*/
107+
public function create($topicName, $entityParams, $groupId, $operationId): OperationInterface
108+
{
109+
return $this->createByTopic($topicName, $entityParams, $groupId);
110+
}
98111
}

app/code/Magento/AsynchronousOperations/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<preference for="Magento\AsynchronousOperations\Api\Data\BulkOperationsStatusInterface" type="Magento\AsynchronousOperations\Model\BulkStatus\Short" />
1919
<preference for="Magento\AsynchronousOperations\Api\Data\OperationSearchResultsInterface" type="Magento\AsynchronousOperations\Model\OperationSearchResults" />
2020
<preference for="Magento\AsynchronousOperations\Api\OperationRepositoryInterface" type="Magento\AsynchronousOperations\Model\OperationRepository" />
21+
<preference for="Magento\AsynchronousOperations\Model\OperationRepositoryInterface" type="Magento\AsynchronousOperations\Model\ResourceModel\Operation\OperationRepository" />
2122
<type name="Magento\Framework\EntityManager\MetadataPool">
2223
<arguments>
2324
<argument name="metadata" xsi:type="array">

app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml renamed to app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="CreateAnAdminOrderUsingBraintreePaymentTest1">
11+
<test name="CreateAnAdminOrderUsingBraintreePaymentTest1Test">
1212
<annotations>
1313
<features value="Backend"/>
1414
<stories value="Creation an admin order using Braintree payment"/>

app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml renamed to app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscountTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="CreateAdminOrderPayedWithOnlinePaymentIncludingTaxAndDiscount">
11+
<test name="CreateAdminOrderPayedWithOnlinePaymentIncludingTaxAndDiscountTest">
1212
<annotations>
1313
<features value="Braintree"/>
1414
<stories value="Get access to a New Credit Memo Page from Invoice for Order payed with online payment via Admin"/>

app/code/Magento/Bundle/Test/Mftf/Test/AdminCreateAndEditBundleProductSettingsTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126

127127
<!-- Verify Url Key after changing -->
128128
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
129-
<argument name="productUrl" value="{{ApiBundleProduct.name}}"/>
129+
<argument name="productUrl" value="{{ApiBundleProduct.urlKey}}"/>
130130
</actionGroup>
131131

132132
<!-- Assert product design settings "Layout empty" -->

app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteABundleProduct.xml renamed to app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteABundleProductTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="AdminDeleteABundleProduct">
11+
<test name="AdminDeleteABundleProductTest">
1212
<annotations>
1313
<features value="Bundle"/>
1414
<stories value="Admin list bundle products"/>

app/code/Magento/Bundle/Test/Mftf/Test/AdminFilterProductListByBundleProduct.xml renamed to app/code/Magento/Bundle/Test/Mftf/Test/AdminFilterProductListByBundleProductTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="AdminFilterProductListByBundleProduct">
11+
<test name="AdminFilterProductListByBundleProductTest">
1212
<annotations>
1313
<features value="Bundle"/>
1414
<stories value="Admin list bundle products"/>

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductShownInCategoryListAndGrid.xml renamed to app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductShownInCategoryListAndGridTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="StorefrontBundleProductShownInCategoryListAndGrid">
11+
<test name="StorefrontBundleProductShownInCategoryListAndGridTest">
1212
<annotations>
1313
<features value="Bundle"/>
1414
<stories value="Bundle products list on Storefront"/>

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCheckBundleProductOptionTierPrices.xml renamed to app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCheckBundleProductOptionTierPricesTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="StorefrontCheckBundleProductOptionTierPrices">
11+
<test name="StorefrontCheckBundleProductOptionTierPricesTest">
1212
<annotations>
1313
<features value="Bundle"/>
1414
<stories value="View bundle products"/>

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontGoToDetailsPageWhenAddingToCartTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="StorefrontGoToDetailsPageWhenAddingToCart">
11+
<test name="StorefrontGoToDetailsPageWhenAddingToCartTest">
1212
<annotations>
1313
<features value="Bundle"/>
1414
<stories value="Bundle products list on Storefront"/>

app/code/Magento/Captcha/Test/Mftf/Test/CaptchaFormsDisplayingTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<scrollToTopOfPage stepKey="ScrollToTop"/>
6666
<click selector="{{CaptchaFormsDisplayingSection.captcha}}" stepKey="ClickToCloseCaptcha"/>
6767
</test>
68-
<test name="CaptchaWithDisabledGuestCheckout">
68+
<test name="CaptchaWithDisabledGuestCheckoutTest">
6969
<annotations>
7070
<features value="Captcha"/>
7171
<stories value="MC-5602 - CAPTCHA doesn't appear in login popup after refreshing page."/>

app/code/Magento/Catalog/Block/Product/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @method string getHeight()
1515
* @method string getLabel()
1616
* @method float getRatio()
17-
* @method string getCustomAttributes()
17+
* @method array getCustomAttributes()
1818
* @method string getClass()
1919
* @since 100.0.2
2020
*/

app/code/Magento/Catalog/Block/Product/ImageFactory.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,17 @@ public function __construct(
6868
}
6969

7070
/**
71-
* Retrieve image custom attributes for HTML element
71+
* Remove class from custom attributes
7272
*
7373
* @param array $attributes
74-
* @return string
74+
* @return array
7575
*/
76-
private function getStringCustomAttributes(array $attributes): string
76+
private function filterCustomAttributes(array $attributes): array
7777
{
78-
$result = [];
79-
foreach ($attributes as $name => $value) {
80-
if ($name != 'class') {
81-
$result[] = $name . '="' . $value . '"';
82-
}
78+
if (isset($attributes['class'])) {
79+
unset($attributes['class']);
8380
}
84-
return !empty($result) ? implode(' ', $result) : '';
81+
return $attributes;
8582
}
8683

8784
/**
@@ -170,7 +167,7 @@ public function create(Product $product, string $imageId, array $attributes = nu
170167
'height' => $imageMiscParams['image_height'],
171168
'label' => $this->getLabel($product, $imageMiscParams['image_type']),
172169
'ratio' => $this->getRatio($imageMiscParams['image_width'] ?? 0, $imageMiscParams['image_height'] ?? 0),
173-
'custom_attributes' => $this->getStringCustomAttributes($attributes),
170+
'custom_attributes' => $this->filterCustomAttributes($attributes),
174171
'class' => $this->getClass($attributes),
175172
'product_id' => $product->getId()
176173
],

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,9 @@ public function getQuantityValidators()
323323
*/
324324
public function getIdentities()
325325
{
326-
$identities = $this->getProduct()->getIdentities();
326+
$product = $this->getProduct();
327327

328-
return $identities;
328+
return $product ? $product->getIdentities() : [];
329329
}
330330

331331
/**

app/code/Magento/Catalog/Model/Category/DataProvider.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
* @api
4242
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
4343
* @SuppressWarnings(PHPMD.TooManyFields)
44+
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
4445
* @since 101.0.0
4546
*/
4647
class DataProvider extends ModifierPoolDataProvider
@@ -176,6 +177,10 @@ class DataProvider extends ModifierPoolDataProvider
176177
* @var AuthorizationInterface
177178
*/
178179
private $auth;
180+
/**
181+
* @var Image
182+
*/
183+
private $categoryImage;
179184

180185
/**
181186
* @param string $name
@@ -196,6 +201,7 @@ class DataProvider extends ModifierPoolDataProvider
196201
* @param ScopeOverriddenValue|null $scopeOverriddenValue
197202
* @param ArrayManager|null $arrayManager
198203
* @param FileInfo|null $fileInfo
204+
* @param Image|null $categoryImage
199205
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
200206
*/
201207
public function __construct(
@@ -216,7 +222,8 @@ public function __construct(
216222
?ArrayUtils $arrayUtils = null,
217223
ScopeOverriddenValue $scopeOverriddenValue = null,
218224
ArrayManager $arrayManager = null,
219-
FileInfo $fileInfo = null
225+
FileInfo $fileInfo = null,
226+
?Image $categoryImage = null
220227
) {
221228
$this->eavValidationRules = $eavValidationRules;
222229
$this->collection = $categoryCollectionFactory->create();
@@ -232,6 +239,7 @@ public function __construct(
232239
ObjectManager::getInstance()->get(ScopeOverriddenValue::class);
233240
$this->arrayManager = $arrayManager ?: ObjectManager::getInstance()->get(ArrayManager::class);
234241
$this->fileInfo = $fileInfo ?: ObjectManager::getInstance()->get(FileInfo::class);
242+
$this->categoryImage = $categoryImage ?? ObjectManager::getInstance()->get(Image::class);
235243

236244
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool);
237245
}
@@ -601,11 +609,7 @@ private function convertValues($category, $categoryData): array
601609
// phpcs:ignore Magento2.Functions.DiscouragedFunction
602610
$categoryData[$attributeCode][0]['name'] = basename($fileName);
603611

604-
if ($this->fileInfo->isBeginsWithMediaDirectoryPath($fileName)) {
605-
$categoryData[$attributeCode][0]['url'] = $fileName;
606-
} else {
607-
$categoryData[$attributeCode][0]['url'] = $category->getImageUrl($attributeCode);
608-
}
612+
$categoryData[$attributeCode][0]['url'] = $this->categoryImage->getUrl($category, $attributeCode);
609613

610614
$categoryData[$attributeCode][0]['size'] = isset($stat) ? $stat['size'] : 0;
611615
$categoryData[$attributeCode][0]['type'] = $mime;

app/code/Magento/Catalog/Model/Category/FileInfo.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,15 @@ private function getMediaDirectoryPathRelativeToBaseDirectoryPath(string $filePa
245245

246246
return $mediaDirectoryRelativeSubpath;
247247
}
248+
249+
/**
250+
* Get file relative path to media directory
251+
*
252+
* @param string $filename
253+
* @return string
254+
*/
255+
public function getRelativePathToMediaDirectory(string $filename): string
256+
{
257+
return $this->getFilePath($filename);
258+
}
248259
}

0 commit comments

Comments
 (0)