Skip to content

Commit

Permalink
Merge branch '2.4-develop' into fix-30094
Browse files Browse the repository at this point in the history
  • Loading branch information
Morgy93 authored Oct 20, 2020
2 parents 40df5c8 + c03bde6 commit b7e6429
Show file tree
Hide file tree
Showing 54 changed files with 1,634 additions and 196 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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="StorefrontCheckPresentSubCategoryActionGroup">
<annotations>
<description>Checks for a subcategory in topmenu</description>
</annotations>
<arguments>
<argument name="parenCategoryName" type="string"/>
<argument name="childCategoryName" type="string"/>
</arguments>

<waitForElementVisible selector="{{StorefrontHeaderSection.NavigationCategoryByName(parenCategoryName)}}" stepKey="waitForTopMenuLoaded"/>
<moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName(parenCategoryName)}}" stepKey="moveMouseToParentCategory"/>
<seeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(childCategoryName)}}" stepKey="seeSubcategoryInTree"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
<section name="AdminCategoryModalSection"/>
<section name="AdminCategoryMessagesSection"/>
<section name="AdminCategoryContentSection"/>
<section name="AdminCategoryScheduleDesignUpdateSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
<element name="FieldError" type="text" selector=".admin__field-error[data-bind='attr: {for: {{field}}}, text: error']" parameterized="true"/>
<element name="panelFieldControl" type="input" selector="//aside//div[@data-index=&quot;{{arg1}}&quot;]/descendant::*[@name=&quot;{{arg2}}&quot;]" parameterized="true"/>
<element name="productsInCategory" type="input" selector="div[data-index='assign_products']" timeout="30"/>
<element name="scheduleDesignUpdateTab" type="block" selector="div[data-index='schedule_design_update']" timeout="15"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="AdminCategoryScheduleDesignUpdateSection">
<element name="sectionHeader" type="button" selector="div[data-index='schedule_design_update'] .fieldset-wrapper-title" timeout="30"/>
<element name="sectionBody" type="text" selector="div[data-index='schedule_design_update'] .admin__fieldset-wrapper-content"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminProductCategoryIndexerInUpdateOnScheduleModeTest">
<annotations>
<features value="Catalog"/>
<stories value="Product Categories Indexer"/>
<title value="Product Categories Indexer in Update on Schedule mode"/>
<description value="The test verifies that in Update on Schedule mode if displaying of category products on Storefront changes due to product properties change,
the changes are NOT applied immediately, but applied only after cron runs (twice)."/>
<severity value="BLOCKER"/>
<testCaseId value="MC-11146"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-26119"/>
<group value="catalog"/>
<group value="indexer"/>
<skip>
<issueId value="MC-20392"/>
</skip>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function setUp(): void
$this->closureMock = function () use ($productMock) {
return $productMock;
};
$this->rollbackClosureMock = function () use ($productMock) {
$this->rollbackClosureMock = function () {
throw new \Exception(self::ERROR_MSG);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function resolve(
$this->tiers->addProductFilter($productId);

return $this->valueFactory->create(
function () use ($productId, $context) {
function () use ($productId) {
$tierPrices = $this->tiers->getProductTierPrices($productId);

return $tierPrices ?? [];
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/CatalogSearch/Model/Advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ protected function getPreparedSearchCriteria($attribute, $value)
if (is_array($value)) {
if (isset($value['from']) && isset($value['to'])) {
if (!empty($value['from']) || !empty($value['to'])) {
$from = '';
$to = '';
if (isset($value['currency'])) {
/** @var $currencyModel Currency */
$currencyModel = $this->_currencyFactory->create()->load($value['currency']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
<selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{customerAddressVar.state}}" stepKey="selectRegion"/>
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/>
<fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
<waitForPageLoad stepKey="waitForLoadingMask"/>
<click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
<waitForElementVisible selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
<waitForPageLoad stepKey="waitForShippingLoadingMask"/>
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
<waitForElementVisible selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
<seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>
</actionGroup>
</actionGroups>
3 changes: 1 addition & 2 deletions app/code/Magento/Customer/Controller/Adminhtml/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,8 @@ protected function prepareDefaultCustomerTitle(\Magento\Backend\Model\View\Resul
protected function _addSessionErrorMessages($messages)
{
$messages = (array)$messages;
$session = $this->_getSession();

$callback = function ($error) use ($session) {
$callback = function ($error) {
if (!$error instanceof Error) {
$error = new Error($error);
}
Expand Down
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="AssertStorefrontCustomerHasNoOtherAddressesActionGroup">
<annotations>
<description>Verifies customer has no additional address in address book</description>
</annotations>
<amOnPage url="{{StorefrontCustomerAddressesPage.url}}" stepKey="goToAddressPage"/>
<waitForText userInput="You have no other address entries in your address book." selector=".block-addresses-list" stepKey="assertOtherAddresses"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
use Magento\Framework\DataObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;

class BillingTest extends TestCase
{
Expand All @@ -23,10 +22,7 @@ class BillingTest extends TestCase

protected function setUp(): void
{
$logger = $this->getMockBuilder(LoggerInterface::class)
->getMock();
/** @var LoggerInterface $logger */
$this->testable = new Billing($logger);
$this->testable = new Billing();
}

public function testBeforeSave()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
use Magento\Framework\DataObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;

class ShippingTest extends TestCase
{
Expand All @@ -23,10 +22,7 @@ class ShippingTest extends TestCase

protected function setUp(): void
{
$logger = $this->getMockBuilder(LoggerInterface::class)
->getMock();
/** @var LoggerInterface $logger */
$this->testable = new Shipping($logger);
$this->testable = new Shipping();
}

public function testBeforeSave()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function setUp(): void
$this->closureMock = function () use ($customerMock) {
return $customerMock;
};
$this->rollbackClosureMock = function () use ($customerMock) {
$this->rollbackClosureMock = function () {
throw new \Exception(self::ERROR_MSG);
};

Expand Down
6 changes: 6 additions & 0 deletions app/code/Magento/Sales/Model/AdminOrder/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,9 @@ public function initFromOrder(\Magento\Sales\Model\Order $order)

$quote = $this->getQuote();
if (!$quote->isVirtual() && $this->getShippingAddress()->getSameAsBilling()) {
$quote->getBillingAddress()->setCustomerAddressId(
$quote->getShippingAddress()->getCustomerAddressId()
);
$this->setShippingAsBilling(1);
}

Expand Down Expand Up @@ -2120,6 +2123,9 @@ private function isAddressesAreEqual(Order $order)
$billingData['address_type'],
$billingData['entity_id']
);
if (isset($shippingData['customer_address_id']) && !isset($billingData['customer_address_id'])) {
unset($shippingData['customer_address_id']);
}

return $shippingData == $billingData;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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="AdminStartReorderFromOrderPageActionGroup">
<annotations>
<description>Reorder existing order. Requires admin order page to be opened.</description>
</annotations>

<click selector="{{AdminOrderDetailsMainActionsSection.reorder}}" stepKey="clickReorder"/>
<waitForPageLoad stepKey="waitPageLoad"/>
<waitForElementVisible selector="{{AdminHeaderSection.pageTitle}}" stepKey="waitForPageTitle"/>
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeCreateNewOrderPageTitle"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?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="AdminReorderAddressNotSavedInAddressBookTest">
<annotations>
<features value="Sales"/>
<stories value="Reorder"/>
<title value="Same shipping address is not repeating multiple times in storefront checkout when Reordered"/>
<description value="Same shipping address is not repeating multiple times in storefront checkout when Reordered"/>
<testCaseId value="MC-38412"/>
<useCaseId value="MC-38113"/>
<severity value="MAJOR"/>
<group value="sales"/>
</annotations>
<before>
<createData entity="ApiCategory" stepKey="category"/>
<createData entity="ApiSimpleProduct" stepKey="product">
<requiredEntity createDataKey="category"/>
</createData>
<createData entity="Simple_Customer_Without_Address" stepKey="customer"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount">
<argument name="Customer" value="$customer$"/>
</actionGroup>
</before>
<after>
<deleteData createDataKey="product" stepKey="deleteProduct"/>
<deleteData createDataKey="category" stepKey="deleteCategory"/>
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/>
<deleteData createDataKey="customer" stepKey="deleteCustomer"/>
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
</after>

<!-- Create order for registered customer -->
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProductToOrder">
<argument name="product" value="$product$"/>
</actionGroup>
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="openCheckoutPage"/>
<actionGroup ref="LoggedInUserCheckoutFillingShippingSectionActionGroup" stepKey="fillAddressForm"/>
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>

<!-- Reorder created order -->
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrderById">
<argument name="orderId" value="{$grabOrderNumber}"/>
</actionGroup>
<actionGroup ref="AdminStartReorderFromOrderPageActionGroup" stepKey="startReorder"/>
<actionGroup ref="AdminSubmitOrderActionGroup" stepKey="submitOrder"/>

<!-- Assert no additional addresses saved -->
<actionGroup ref="AssertStorefrontCustomerHasNoOtherAddressesActionGroup" stepKey="assertAddresses"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ endif; ?>
type="checkbox"
id="<?= $block->escapeHtmlAttr($block->getForm()->getHtmlIdPrefix()) ?>save_in_address_book"
value="1"
<?php if (!$block->getDontSaveInAddressBook()): ?> checked="checked"<?php endif; ?>
<?php if (!$block->getDontSaveInAddressBook() && !$block->getAddressId()): ?>
checked="checked"
<?php endif; ?>
class="admin__control-checkbox"/>
<label for="<?= $block->escapeHtmlAttr($block->getForm()->getHtmlIdPrefix()) ?>save_in_address_book"
class="admin__field-label"><?= $block->escapeHtml(__('Save in address book')) ?></label>
Expand Down
12 changes: 6 additions & 6 deletions app/code/Magento/SendFriend/Model/ResourceModel/SendFriend.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
namespace Magento\SendFriend\Model\ResourceModel;

/**
* SendFriend Log Resource Model
*
* @author Magento Core Team <[email protected]>
*
* @api
* @since 100.0.2
*/
Expand All @@ -32,6 +28,7 @@ protected function _construct()
* @param int $ip
* @param int $startTime
* @param int $websiteId
*
* @return int
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
Expand All @@ -46,7 +43,7 @@ public function getSendCount($object, $ip, $startTime, $websiteId = null)
AND time>=:time
AND website_id=:website_id'
);
$bind = ['ip' => ip2long($ip), 'time' => $startTime, 'website_id' => (int)$websiteId];
$bind = ['ip' => $ip, 'time' => $startTime, 'website_id' => (int)$websiteId];

$row = $connection->fetchRow($select, $bind);
return $row['count'];
Expand All @@ -58,21 +55,24 @@ public function getSendCount($object, $ip, $startTime, $websiteId = null)
* @param int $ip
* @param int $startTime
* @param int $websiteId
*
* @return $this
*/
public function addSendItem($ip, $startTime, $websiteId)
{
$this->getConnection()->insert(
$this->getMainTable(),
['ip' => ip2long($ip), 'time' => $startTime, 'website_id' => $websiteId]
['ip' => $ip, 'time' => $startTime, 'website_id' => $websiteId]
);

return $this;
}

/**
* Delete Old logs
*
* @param int $time
*
* @return $this
*/
public function deleteLogsBefore($time)
Expand Down
Loading

0 comments on commit b7e6429

Please sign in to comment.