Skip to content

Commit

Permalink
Merge branch '2.4-develop' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
litsher authored Jun 10, 2020
2 parents f44321f + 8513dfd commit ba12f12
Show file tree
Hide file tree
Showing 135 changed files with 3,869 additions and 1,458 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function getItems()
$this->_compareProduct->setAllowUsedFlat(false);

$this->_items = $this->_itemCollectionFactory->create();
$this->_items->useProductItem(true)->setStoreId($this->_storeManager->getStore()->getId());
$this->_items->useProductItem()->setStoreId($this->_storeManager->getStore()->getId());

if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
$this->_items->setCustomerId($this->currentCustomer->getCustomerId());
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/Helper/Product/Compare.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public function getItemCollection()
// cannot be placed in constructor because of the cyclic dependency which cannot be fixed with proxy class
// collection uses this helper in constructor when calling isEnabledFlat() method
$this->_itemCollection = $this->_itemCollectionFactory->create();
$this->_itemCollection->useProductItem(true)->setStoreId($this->_storeManager->getStore()->getId());
$this->_itemCollection->useProductItem()->setStoreId($this->_storeManager->getStore()->getId());

if ($this->_customerSession->isLoggedIn()) {
$this->_itemCollection->setCustomerId($this->_customerSession->getCustomerId());
Expand Down Expand Up @@ -313,7 +313,7 @@ public function calculate($logout = false)
{
/** @var $collection Collection */
$collection = $this->_itemCollectionFactory->create()
->useProductItem(true);
->useProductItem();
if (!$logout && $this->_customerSession->isLoggedIn()) {
$collection->setCustomerId($this->_customerSession->getCustomerId());
} elseif ($this->_customerId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminProductFormCategoryExistInCategoryListActionGroup">
<annotations>
<description>Check Category exist in Category list for Assign to Product.</description>
</annotations>
<arguments>
<argument name="categoryName" type="string"/>
</arguments>

<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/>
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="{{categoryName}}"
stepKey="fillSearchCategory"/>
<see selector="{{AdminProductFormSection.selectCategory(categoryName)}}" userInput="{{categoryName}}"
stepKey="seeCategory"/>
<click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneAdvancedCategorySelect"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminProductFormCategoryNotExistInCategoryListActionGroup">
<annotations>
<description>Check Category not exist in Category list for Assign to Product.</description>
</annotations>
<arguments>
<argument name="categoryName" type="string"/>
</arguments>

<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/>
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="{{categoryName}}"
stepKey="fillSearchCategory"/>
<dontSee selector="{{AdminProductFormSection.selectCategory(categoryName)}}" userInput="{{categoryName}}"
stepKey="seeCategory"/>
<click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneAdvancedCategorySelect"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminSubmitCategoriesPopupActionGroup">
<annotations>
<description>Clicks the "Done" button on the Search Categories popup.</description>
</annotations>

<click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneButton" />
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertStorefrontCategoryCurrentPageIsNthActionGroup">
<arguments>
<argument name="expectedPage" type="string"/>
</arguments>

<grabTextFrom selector="{{StorefrontCategoryBottomToolbarSection.currentPage}}" stepKey="currentPageText"/>
<assertEquals stepKey="assertIsPageNth">
<expectedResult type="string">{{expectedPage}}</expectedResult>
<actualResult type="variable">currentPageText</actualResult>
</assertEquals>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontNavigateCategoryNextPageActionGroup">
<annotations>
<description>Navigates storefront category next page from toolbar</description>
</annotations>
<scrollTo selector="{{StorefrontCategoryBottomToolbarSection.nextPage}}" stepKey="scrollToNextButton"/>
<click selector="{{StorefrontCategoryBottomToolbarSection.nextPage}}" stepKey="clickOnNextPage"/>
<waitForPageLoad stepKey="waitForNextCategoryPageLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
<element name="previousPage" type="button" selector=".//*[@class='toolbar toolbar-products'][2]//a[contains(@class, 'previous')]" timeout="30"/>
<element name="pageNumber" type="text" selector="//*[@class='toolbar toolbar-products'][2]//a[contains(@class, 'page')]//span[2][contains(text() ,'{{var1}}')]" parameterized="true"/>
<element name="perPage" type="select" selector="//*[@class='toolbar toolbar-products'][2]//select[@id='limiter']"/>
<element name="currentPage" type="text" selector=".products.wrapper + .toolbar-products .pages .current span:nth-of-type(2)"/>
<element name="currentPage" type="text" selector=".//*[@class='toolbar toolbar-products'][2]//li[contains(@class, 'current')]//span[2]" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,11 @@ public function prepareProductIndex($indexData, $productData, $storeId)
foreach ($indexData as $entityId => $attributeData) {
foreach ($attributeData as $attributeId => $attributeValues) {
$value = $this->getAttributeValue($attributeId, $attributeValues, $storeId);
if (!empty($value)) {
if ($value !== null && $value !== false && $value != '') {
if (!isset($index[$attributeId])) {
$index[$attributeId] = [];
}
$index[$attributeId][$entityId] = $value;
$index[$attributeId][$entityId] = $value;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<stories value="Use Advanced Search"/>
<title value="Unable negative price use to advanced search"/>
<description value="Check unable negative price use to advanced search by price from and price to"/>
<severity value="MAJOR"/>
</annotations>
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToStorefront"/>
<actionGroup ref="StorefrontOpenAdvancedSearchActionGroup" stepKey="openAdvancedSearch"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<item name="trigger" xsi:type="string">opc-new-shipping-address</item>
<item name="buttons" xsi:type="array">
<item name="save" xsi:type="array">
<item name="text" xsi:type="string" translate="true">Ship here</item>
<item name="text" xsi:type="string" translate="true">Ship Here</item>
<item name="class" xsi:type="string">action primary action-save-address</item>
</item>
<item name="cancel" xsi:type="array">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<stories value="Delete a CMS Page via the Admin"/>
<title value="Admin should be able to delete CMS Pages"/>
<description value="Admin should be able to delete CMS Pages"/>
<severity value="CRITICAL"/>
<group value="Cms"/>
<group value="WYSIWYGDisabled"/>
</annotations>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,5 @@
{{trans "We have received a request to change the following information associated with your account at %store_name: email." store_name=$store.frontend_name}}
{{trans 'If you have not authorized this action, please contact us immediately at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
</p>
<br>

<p>{{trans "Thanks,<br>%store_name" store_name=$store.frontend_name |raw}}</p>

{{template config_path="design/email/footer_template"}}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,5 @@
{{trans "We have received a request to change the following information associated with your account at %store_name: email, password." store_name=$store.frontend_name}}
{{trans 'If you have not authorized this action, please contact us immediately at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
</p>
<br>

<p>{{trans "Thanks,<br>%store_name" store_name=$store.frontend_name |raw}}</p>

{{template config_path="design/email/footer_template"}}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,5 @@
{{trans "We have received a request to change the following information associated with your account at %store_name: password." store_name=$store.frontend_name}}
{{trans 'If you have not authorized this action, please contact us immediately at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
</p>
<br>

<p>{{trans "Thanks,<br>%store_name" store_name=$store.frontend_name |raw}}</p>

{{template config_path="design/email/footer_template"}}
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private function convertAttribute(Attribute $attribute, array $attributeValues,
$productAttributes = [];

$retrievedValue = $this->retrieveFieldValue($attributeValues);
if ($retrievedValue) {
if ($retrievedValue !== null) {
$productAttributes[$attribute->getAttributeCode()] = $retrievedValue;

if ($attribute->getIsSearchable()) {
Expand Down Expand Up @@ -354,7 +354,7 @@ private function getAttributeOptions(Attribute $attribute, int $storeId): array
*/
private function retrieveFieldValue(array $values)
{
$values = \array_filter(\array_unique($values));
$values = \array_unique($values);

return count($values) === 1 ? \array_shift($values) : \array_values($values);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function buildFilter(RequestFilterInterface $filter)
$fieldName .= '.' . $suffix;
}

if ($filter->getValue()) {
if ($filter->getValue() !== false) {
$operator = is_array($filter->getValue()) ? 'terms' : 'term';
$filterQuery []= [
$operator => [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\GiftMessageGraphQl\Model\Resolver\Cart;

use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
use Magento\Framework\GraphQl\Query\Resolver\Value;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\GiftMessage\Api\CartRepositoryInterface;
use Magento\GiftMessage\Helper\Message as GiftMessageHelper;

/**
* Class provides ability to get GiftMessage for cart
*/
class GiftMessage implements ResolverInterface
{
/**
* @var CartRepositoryInterface
*/
private $cartRepository;

/**
* @var GiftMessageHelper
*/
private $giftMessageHelper;

/**
* @param CartRepositoryInterface $cartRepository
* @param GiftMessageHelper $giftMessageHelper
*/
public function __construct(
CartRepositoryInterface $cartRepository,
GiftMessageHelper $giftMessageHelper
) {
$this->cartRepository = $cartRepository;
$this->giftMessageHelper = $giftMessageHelper;
}

/**
* Return information about Gift message of cart
*
* @param Field $field
* @param ContextInterface $context
* @param ResolveInfo $info
* @param array|null $value
* @param array|null $args
*
* @return array|Value|mixed
*
* @throws GraphQlInputException
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function resolve(
Field $field,
$context,
ResolveInfo $info,
array $value = null,
array $args = null
) {
if (!isset($value['model'])) {
throw new GraphQlInputException(__('"model" value should be specified'));
}

$cart = $value['model'];

if (!$this->giftMessageHelper->isMessagesAllowed('order', $cart)) {
return null;
}

try {
$giftCartMessage = $this->cartRepository->get($cart->getId());
} catch (LocalizedException $e) {
throw new GraphQlInputException(__('Can\'t load cart.'));
}

if (!isset($giftCartMessage)) {
return null;
}

return [
'to' => $giftCartMessage->getRecipient() ?? '',
'from' => $giftCartMessage->getSender() ?? '',
'message'=> $giftCartMessage->getMessage() ?? ''
];
}
}
Loading

0 comments on commit ba12f12

Please sign in to comment.