Skip to content

Commit 0fbe1f9

Browse files
author
Prabhu Ram
committed
Merge remote-tracking branch 'mainline/2.4-develop' into wishlist-gql-ce-248
2 parents 6ffc556 + 8aa1d46 commit 0fbe1f9

File tree

171 files changed

+9064
-678
lines changed

Some content is hidden

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

171 files changed

+9064
-678
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="StorefrontCustomerCheckoutWithCustomerGroupTest">
11+
<annotations>
12+
<features value="Customer Checkout"/>
13+
<stories value="Customer checkout with Customer Group assigned"/>
14+
<title value="Place order by Customer with Customer Group assigned"/>
15+
<description value="Customer Group should be assigned to Order when setting Auto Group Assign is enabled for Customer"/>
16+
<testCaseId value="MC-37259"/>
17+
<severity value="MAJOR"/>
18+
<group value="checkout"/>
19+
<group value="customer"/>
20+
</annotations>
21+
<before>
22+
23+
<magentoCLI command="config:set customer/create_account/auto_group_assign 1" stepKey="enableAutoGroupAssign"/>
24+
25+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
26+
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
27+
<requiredEntity createDataKey="createCategory"/>
28+
</createData>
29+
30+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
31+
32+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
33+
34+
<actionGroup ref="AdminUpdateCustomerGroupByEmailActionGroup" stepKey="updateCustomerGroup">
35+
<argument name="emailAddress" value="$$createCustomer.email$$"/>
36+
<argument name="customerGroup" value="Retail"/>
37+
</actionGroup>
38+
39+
</before>
40+
<after>
41+
<magentoCLI command="config:set customer/create_account/auto_group_assign 0" stepKey="disableAutoGroupAssign"/>
42+
43+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
44+
<deleteData createDataKey="createCustomer" stepKey="deleteUsCustomer"/>
45+
<actionGroup ref="AdminClearCustomersFiltersActionGroup" stepKey="resetCustomerFilters"/>
46+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
47+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
48+
<deleteData createDataKey="createCategory" stepKey="deleteSimpleCategory"/>
49+
</after>
50+
51+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="storefrontCustomerLogin">
52+
<argument name="Customer" value="$$createCustomer$$"/>
53+
</actionGroup>
54+
55+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="navigateToCategoryPage">
56+
<argument name="category" value="$$createCategory$$"/>
57+
</actionGroup>
58+
59+
<waitForPageLoad stepKey="waitForCatalogPageLoad"/>
60+
61+
<actionGroup ref="StorefrontAddCategoryProductToCartActionGroup" stepKey="addProductToCart">
62+
<argument name="product" value="$$createSimpleProduct$$"/>
63+
<argument name="productCount" value="CONST.one"/>
64+
</actionGroup>
65+
66+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
67+
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRate"/>
68+
<actionGroup ref="StorefrontCheckoutForwardFromShippingStepActionGroup" stepKey="goToReview"/>
69+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyOrder"/>
70+
<actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="clickOnPlaceOrder">
71+
<argument name="orderNumberMessage" value="CONST.successCheckoutOrderNumberMessage"/>
72+
<argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage"/>
73+
</actionGroup>
74+
75+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="orderNumber"/>
76+
77+
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="addFilterToGridAndOpenOrder">
78+
<argument name="orderId" value="{$orderNumber}"/>
79+
</actionGroup>
80+
81+
<see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="verifyOrderStatus"/>
82+
<see selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="Customer" stepKey="verifyAccountInformation"/>
83+
<see selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="$$createCustomer.email$$" stepKey="verifyCustomerEmail"/>
84+
<see selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="Retail" stepKey="verifyCustomerGroup"/>
85+
<see selector="{{AdminOrderDetailsInformationSection.billingAddress}}" userInput="{{US_Address_TX.street[0]}}" stepKey="verifyBillingAddress"/>
86+
<see selector="{{AdminOrderDetailsInformationSection.shippingAddress}}" userInput="{{US_Address_TX.street[0]}}" stepKey="verifyShippingAddress"/>
87+
<see selector="{{AdminOrderDetailsInformationSection.itemsOrdered}}" userInput="$$createSimpleProduct.name$$" stepKey="verifyProductName"/>
88+
89+
</test>
90+
</tests>

app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFolder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
namespace Magento\Cms\Controller\Adminhtml\Wysiwyg\Images;
1111

1212
use Magento\Framework\App\Action\HttpPostActionInterface;
13-
use Magento\Framework\App\Filesystem\DirectoryList;
1413

1514
/**
1615
* Delete image folder.

app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/NewFolder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function execute()
6565
}
6666
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
6767
$resultJson = $this->resultJsonFactory->create();
68-
68+
6969
return $resultJson->setData($result);
7070
}
7171
}

app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/Upload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function execute()
7474
}
7575
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
7676
$resultJson = $this->resultJsonFactory->create();
77-
77+
7878
return $resultJson->setData($response);
7979
}
8080
}

app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpenCmsPageActionGroup.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1010
<actionGroup name="AdminOpenCmsPageActionGroup">
11+
<annotations>
12+
<description>Open CMS edit page.</description>
13+
</annotations>
1114
<arguments>
1215
<argument name="page_id" type="string"/>
1316
</arguments>

app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminOpentCmsBlockActionGroup.xml

Lines changed: 0 additions & 16 deletions
This file was deleted.

app/code/Magento/MediaContentSynchronization/Model/Consume.php

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,85 @@
77

88
namespace Magento\MediaContentSynchronization\Model;
99

10+
use Magento\AsynchronousOperations\Api\Data\OperationInterface;
11+
use Magento\Framework\Exception\LocalizedException;
12+
use Magento\Framework\Serialize\SerializerInterface;
13+
use Magento\MediaContentApi\Api\Data\ContentIdentityInterfaceFactory;
14+
use Magento\MediaContentSynchronizationApi\Api\SynchronizeIdentitiesInterface;
1015
use Magento\MediaContentSynchronizationApi\Api\SynchronizeInterface;
1116

1217
/**
1318
* Media content synchronization queue consumer.
1419
*/
1520
class Consume
1621
{
22+
private const ENTITY_TYPE = 'entityType';
23+
private const ENTITY_ID = 'entityId';
24+
private const FIELD = 'field';
25+
26+
/**
27+
* @var SerializerInterface
28+
*/
29+
private $serializer;
30+
31+
/**
32+
* @var ContentIdentityInterfaceFactory
33+
*/
34+
private $contentIdentityFactory;
35+
1736
/**
1837
* @var SynchronizeInterface
1938
*/
2039
private $synchronize;
2140

2241
/**
42+
* @var SynchronizeIdentitiesInterface
43+
*/
44+
private $synchronizeIdentities;
45+
46+
/**
47+
* @param SerializerInterface $serializer
48+
* @param ContentIdentityInterfaceFactory $contentIdentityFactory
2349
* @param SynchronizeInterface $synchronize
50+
* @param SynchronizeIdentitiesInterface $synchronizeIdentities
2451
*/
25-
public function __construct(SynchronizeInterface $synchronize)
26-
{
52+
public function __construct(
53+
SerializerInterface $serializer,
54+
ContentIdentityInterfaceFactory $contentIdentityFactory,
55+
SynchronizeInterface $synchronize,
56+
SynchronizeIdentitiesInterface $synchronizeIdentities
57+
) {
58+
$this->serializer = $serializer;
59+
$this->contentIdentityFactory = $contentIdentityFactory;
2760
$this->synchronize = $synchronize;
61+
$this->synchronizeIdentities = $synchronizeIdentities;
2862
}
2963

3064
/**
3165
* Run media files synchronization.
66+
*
67+
* @param OperationInterface $operation
68+
* @throws LocalizedException
3269
*/
33-
public function execute() : void
70+
public function execute(OperationInterface $operation) : void
3471
{
35-
$this->synchronize->execute();
72+
$identities = $this->serializer->unserialize($operation->getSerializedData());
73+
74+
if (empty($identities)) {
75+
$this->synchronize->execute();
76+
return;
77+
}
78+
79+
$contentIdentities = [];
80+
foreach ($identities as $identity) {
81+
$contentIdentities[] = $this->contentIdentityFactory->create(
82+
[
83+
self::ENTITY_TYPE => $identity[self::ENTITY_TYPE],
84+
self::ENTITY_ID => $identity[self::ENTITY_ID],
85+
self::FIELD => $identity[self::FIELD]
86+
]
87+
);
88+
}
89+
$this->synchronizeIdentities->execute($contentIdentities);
3690
}
3791
}

app/code/Magento/MediaContentSynchronization/Model/Publish.php

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77

88
namespace Magento\MediaContentSynchronization\Model;
99

10+
use Magento\AsynchronousOperations\Api\Data\OperationInterfaceFactory;
11+
use Magento\Framework\Bulk\OperationInterface;
12+
use Magento\Framework\DataObject\IdentityGeneratorInterface;
1013
use Magento\Framework\MessageQueue\PublisherInterface;
14+
use Magento\Framework\Serialize\SerializerInterface;
1115

1216
/**
1317
* Publish media content synchronization queue.
@@ -19,27 +23,64 @@ class Publish
1923
*/
2024
private const TOPIC_MEDIA_CONTENT_SYNCHRONIZATION = 'media.content.synchronization';
2125

26+
/**
27+
* @var OperationInterfaceFactory
28+
*/
29+
private $operationFactory;
30+
31+
/**
32+
* @var IdentityGeneratorInterface
33+
*/
34+
private $identityService;
35+
2236
/**
2337
* @var PublisherInterface
2438
*/
2539
private $publisher;
2640

2741
/**
42+
* @var SerializerInterface
43+
*/
44+
private $serializer;
45+
46+
/**
47+
* @param OperationInterfaceFactory $operationFactory
48+
* @param IdentityGeneratorInterface $identityService
2849
* @param PublisherInterface $publisher
50+
* @param SerializerInterface $serializer
2951
*/
30-
public function __construct(PublisherInterface $publisher)
31-
{
52+
public function __construct(
53+
OperationInterfaceFactory $operationFactory,
54+
IdentityGeneratorInterface $identityService,
55+
PublisherInterface $publisher,
56+
SerializerInterface $serializer
57+
) {
58+
$this->operationFactory = $operationFactory;
59+
$this->identityService = $identityService;
60+
$this->serializer = $serializer;
3261
$this->publisher = $publisher;
3362
}
3463

3564
/**
36-
* Publish media content synchronization message to the message queue.
65+
* Publish media content synchronization message to the message queue
66+
*
67+
* @param array $contentIdentities
3768
*/
38-
public function execute() : void
69+
public function execute(array $contentIdentities = []) : void
3970
{
71+
$data = [
72+
'data' => [
73+
'bulk_uuid' => $this->identityService->generateId(),
74+
'topic_name' => self::TOPIC_MEDIA_CONTENT_SYNCHRONIZATION,
75+
'serialized_data' => $this->serializer->serialize($contentIdentities),
76+
'status' => OperationInterface::STATUS_TYPE_OPEN,
77+
]
78+
];
79+
$operation = $this->operationFactory->create($data);
80+
4081
$this->publisher->publish(
4182
self::TOPIC_MEDIA_CONTENT_SYNCHRONIZATION,
42-
[self::TOPIC_MEDIA_CONTENT_SYNCHRONIZATION]
83+
$operation
4384
);
4485
}
4586
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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\MediaContentSynchronization\Model;
9+
10+
use Magento\Framework\Exception\LocalizedException;
11+
use Magento\Framework\FlagManager;
12+
use Magento\Framework\Stdlib\DateTime\DateTimeFactory;
13+
use Magento\MediaContentSynchronizationApi\Api\SynchronizeIdentitiesInterface;
14+
use Magento\MediaContentSynchronizationApi\Model\SynchronizeIdentitiesPool;
15+
use Psr\Log\LoggerInterface;
16+
17+
/**
18+
* Batch Synchronize content with assets
19+
*/
20+
class SynchronizeIdentities implements SynchronizeIdentitiesInterface
21+
{
22+
/**
23+
* @var LoggerInterface
24+
*/
25+
private $log;
26+
27+
/**
28+
* @var SynchronizeIdentitiesPool
29+
*/
30+
private $synchronizeIdentitiesPool;
31+
32+
/**
33+
* @param LoggerInterface $log
34+
* @param SynchronizeIdentitiesPool $synchronizeIdentitiesPool
35+
*/
36+
public function __construct(
37+
LoggerInterface $log,
38+
SynchronizeIdentitiesPool $synchronizeIdentitiesPool
39+
) {
40+
$this->log = $log;
41+
$this->synchronizeIdentitiesPool = $synchronizeIdentitiesPool;
42+
}
43+
44+
/**
45+
* @inheritdoc
46+
*/
47+
public function execute(array $mediaContentIdentities): void
48+
{
49+
$failed = [];
50+
51+
foreach ($this->synchronizeIdentitiesPool->get() as $name => $synchronizer) {
52+
try {
53+
$synchronizer->execute($mediaContentIdentities);
54+
} catch (\Exception $exception) {
55+
$this->log->critical($exception);
56+
$failed[] = $name;
57+
}
58+
}
59+
60+
if (!empty($failed)) {
61+
throw new LocalizedException(
62+
__(
63+
'Failed to execute the following content synchronizers: %synchronizers',
64+
[
65+
'synchronizers' => implode(', ', $failed)
66+
]
67+
)
68+
);
69+
}
70+
}
71+
}

0 commit comments

Comments
 (0)