Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/2.4-develop' into wishlist-gql…
Browse files Browse the repository at this point in the history
…-ce-248
  • Loading branch information
prabhuram93 committed Sep 13, 2020
2 parents 6ffc556 + 8aa1d46 commit 0fbe1f9
Show file tree
Hide file tree
Showing 171 changed files with 9,064 additions and 678 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontCustomerCheckoutWithCustomerGroupTest">
<annotations>
<features value="Customer Checkout"/>
<stories value="Customer checkout with Customer Group assigned"/>
<title value="Place order by Customer with Customer Group assigned"/>
<description value="Customer Group should be assigned to Order when setting Auto Group Assign is enabled for Customer"/>
<testCaseId value="MC-37259"/>
<severity value="MAJOR"/>
<group value="checkout"/>
<group value="customer"/>
</annotations>
<before>

<magentoCLI command="config:set customer/create_account/auto_group_assign 1" stepKey="enableAutoGroupAssign"/>

<createData entity="SimpleSubCategory" stepKey="createCategory"/>
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>

<createData entity="Simple_US_Customer" stepKey="createCustomer"/>

<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>

<actionGroup ref="AdminUpdateCustomerGroupByEmailActionGroup" stepKey="updateCustomerGroup">
<argument name="emailAddress" value="$$createCustomer.email$$"/>
<argument name="customerGroup" value="Retail"/>
</actionGroup>

</before>
<after>
<magentoCLI command="config:set customer/create_account/auto_group_assign 0" stepKey="disableAutoGroupAssign"/>

<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
<deleteData createDataKey="createCustomer" stepKey="deleteUsCustomer"/>
<actionGroup ref="AdminClearCustomersFiltersActionGroup" stepKey="resetCustomerFilters"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
<deleteData createDataKey="createCategory" stepKey="deleteSimpleCategory"/>
</after>

<actionGroup ref="LoginToStorefrontActionGroup" stepKey="storefrontCustomerLogin">
<argument name="Customer" value="$$createCustomer$$"/>
</actionGroup>

<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="navigateToCategoryPage">
<argument name="category" value="$$createCategory$$"/>
</actionGroup>

<waitForPageLoad stepKey="waitForCatalogPageLoad"/>

<actionGroup ref="StorefrontAddCategoryProductToCartActionGroup" stepKey="addProductToCart">
<argument name="product" value="$$createSimpleProduct$$"/>
<argument name="productCount" value="CONST.one"/>
</actionGroup>

<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRate"/>
<actionGroup ref="StorefrontCheckoutForwardFromShippingStepActionGroup" stepKey="goToReview"/>
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyOrder"/>
<actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="clickOnPlaceOrder">
<argument name="orderNumberMessage" value="CONST.successCheckoutOrderNumberMessage"/>
<argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage"/>
</actionGroup>

<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="orderNumber"/>

<actionGroup ref="OpenOrderByIdActionGroup" stepKey="addFilterToGridAndOpenOrder">
<argument name="orderId" value="{$orderNumber}"/>
</actionGroup>

<see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="verifyOrderStatus"/>
<see selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="Customer" stepKey="verifyAccountInformation"/>
<see selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="$$createCustomer.email$$" stepKey="verifyCustomerEmail"/>
<see selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="Retail" stepKey="verifyCustomerGroup"/>
<see selector="{{AdminOrderDetailsInformationSection.billingAddress}}" userInput="{{US_Address_TX.street[0]}}" stepKey="verifyBillingAddress"/>
<see selector="{{AdminOrderDetailsInformationSection.shippingAddress}}" userInput="{{US_Address_TX.street[0]}}" stepKey="verifyShippingAddress"/>
<see selector="{{AdminOrderDetailsInformationSection.itemsOrdered}}" userInput="$$createSimpleProduct.name$$" stepKey="verifyProductName"/>

</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
namespace Magento\Cms\Controller\Adminhtml\Wysiwyg\Images;

use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\App\Filesystem\DirectoryList;

/**
* Delete image folder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function execute()
}
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
$resultJson = $this->resultJsonFactory->create();

return $resultJson->setData($result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function execute()
}
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
$resultJson = $this->resultJsonFactory->create();

return $resultJson->setData($response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminOpenCmsPageActionGroup">
<annotations>
<description>Open CMS edit page.</description>
</annotations>
<arguments>
<argument name="page_id" type="string"/>
</arguments>
Expand Down

This file was deleted.

62 changes: 58 additions & 4 deletions app/code/Magento/MediaContentSynchronization/Model/Consume.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,85 @@

namespace Magento\MediaContentSynchronization\Model;

use Magento\AsynchronousOperations\Api\Data\OperationInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Serialize\SerializerInterface;
use Magento\MediaContentApi\Api\Data\ContentIdentityInterfaceFactory;
use Magento\MediaContentSynchronizationApi\Api\SynchronizeIdentitiesInterface;
use Magento\MediaContentSynchronizationApi\Api\SynchronizeInterface;

/**
* Media content synchronization queue consumer.
*/
class Consume
{
private const ENTITY_TYPE = 'entityType';
private const ENTITY_ID = 'entityId';
private const FIELD = 'field';

/**
* @var SerializerInterface
*/
private $serializer;

/**
* @var ContentIdentityInterfaceFactory
*/
private $contentIdentityFactory;

/**
* @var SynchronizeInterface
*/
private $synchronize;

/**
* @var SynchronizeIdentitiesInterface
*/
private $synchronizeIdentities;

/**
* @param SerializerInterface $serializer
* @param ContentIdentityInterfaceFactory $contentIdentityFactory
* @param SynchronizeInterface $synchronize
* @param SynchronizeIdentitiesInterface $synchronizeIdentities
*/
public function __construct(SynchronizeInterface $synchronize)
{
public function __construct(
SerializerInterface $serializer,
ContentIdentityInterfaceFactory $contentIdentityFactory,
SynchronizeInterface $synchronize,
SynchronizeIdentitiesInterface $synchronizeIdentities
) {
$this->serializer = $serializer;
$this->contentIdentityFactory = $contentIdentityFactory;
$this->synchronize = $synchronize;
$this->synchronizeIdentities = $synchronizeIdentities;
}

/**
* Run media files synchronization.
*
* @param OperationInterface $operation
* @throws LocalizedException
*/
public function execute() : void
public function execute(OperationInterface $operation) : void
{
$this->synchronize->execute();
$identities = $this->serializer->unserialize($operation->getSerializedData());

if (empty($identities)) {
$this->synchronize->execute();
return;
}

$contentIdentities = [];
foreach ($identities as $identity) {
$contentIdentities[] = $this->contentIdentityFactory->create(
[
self::ENTITY_TYPE => $identity[self::ENTITY_TYPE],
self::ENTITY_ID => $identity[self::ENTITY_ID],
self::FIELD => $identity[self::FIELD]
]
);
}
$this->synchronizeIdentities->execute($contentIdentities);
}
}
51 changes: 46 additions & 5 deletions app/code/Magento/MediaContentSynchronization/Model/Publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

namespace Magento\MediaContentSynchronization\Model;

use Magento\AsynchronousOperations\Api\Data\OperationInterfaceFactory;
use Magento\Framework\Bulk\OperationInterface;
use Magento\Framework\DataObject\IdentityGeneratorInterface;
use Magento\Framework\MessageQueue\PublisherInterface;
use Magento\Framework\Serialize\SerializerInterface;

/**
* Publish media content synchronization queue.
Expand All @@ -19,27 +23,64 @@ class Publish
*/
private const TOPIC_MEDIA_CONTENT_SYNCHRONIZATION = 'media.content.synchronization';

/**
* @var OperationInterfaceFactory
*/
private $operationFactory;

/**
* @var IdentityGeneratorInterface
*/
private $identityService;

/**
* @var PublisherInterface
*/
private $publisher;

/**
* @var SerializerInterface
*/
private $serializer;

/**
* @param OperationInterfaceFactory $operationFactory
* @param IdentityGeneratorInterface $identityService
* @param PublisherInterface $publisher
* @param SerializerInterface $serializer
*/
public function __construct(PublisherInterface $publisher)
{
public function __construct(
OperationInterfaceFactory $operationFactory,
IdentityGeneratorInterface $identityService,
PublisherInterface $publisher,
SerializerInterface $serializer
) {
$this->operationFactory = $operationFactory;
$this->identityService = $identityService;
$this->serializer = $serializer;
$this->publisher = $publisher;
}

/**
* Publish media content synchronization message to the message queue.
* Publish media content synchronization message to the message queue
*
* @param array $contentIdentities
*/
public function execute() : void
public function execute(array $contentIdentities = []) : void
{
$data = [
'data' => [
'bulk_uuid' => $this->identityService->generateId(),
'topic_name' => self::TOPIC_MEDIA_CONTENT_SYNCHRONIZATION,
'serialized_data' => $this->serializer->serialize($contentIdentities),
'status' => OperationInterface::STATUS_TYPE_OPEN,
]
];
$operation = $this->operationFactory->create($data);

$this->publisher->publish(
self::TOPIC_MEDIA_CONTENT_SYNCHRONIZATION,
[self::TOPIC_MEDIA_CONTENT_SYNCHRONIZATION]
$operation
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\MediaContentSynchronization\Model;

use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\FlagManager;
use Magento\Framework\Stdlib\DateTime\DateTimeFactory;
use Magento\MediaContentSynchronizationApi\Api\SynchronizeIdentitiesInterface;
use Magento\MediaContentSynchronizationApi\Model\SynchronizeIdentitiesPool;
use Psr\Log\LoggerInterface;

/**
* Batch Synchronize content with assets
*/
class SynchronizeIdentities implements SynchronizeIdentitiesInterface
{
/**
* @var LoggerInterface
*/
private $log;

/**
* @var SynchronizeIdentitiesPool
*/
private $synchronizeIdentitiesPool;

/**
* @param LoggerInterface $log
* @param SynchronizeIdentitiesPool $synchronizeIdentitiesPool
*/
public function __construct(
LoggerInterface $log,
SynchronizeIdentitiesPool $synchronizeIdentitiesPool
) {
$this->log = $log;
$this->synchronizeIdentitiesPool = $synchronizeIdentitiesPool;
}

/**
* @inheritdoc
*/
public function execute(array $mediaContentIdentities): void
{
$failed = [];

foreach ($this->synchronizeIdentitiesPool->get() as $name => $synchronizer) {
try {
$synchronizer->execute($mediaContentIdentities);
} catch (\Exception $exception) {
$this->log->critical($exception);
$failed[] = $name;
}
}

if (!empty($failed)) {
throw new LocalizedException(
__(
'Failed to execute the following content synchronizers: %synchronizers',
[
'synchronizers' => implode(', ', $failed)
]
)
);
}
}
}
Loading

0 comments on commit 0fbe1f9

Please sign in to comment.