Skip to content

Commit

Permalink
🔃 [Magento Community Engineering] Community Contributions - 2.4-devel…
Browse files Browse the repository at this point in the history
…op expedited

Accepted Community Pull Requests:
 - #29290: #1618: Duplicated items in Used in Entities filters (by @joweecaquicla)
 - #28975: improve NonComposerComponentRegistration (by @rvitaliy)
 - #29271: Unit Test / Bugfix / Inverted Expected value with actual one (by @lbajsarowicz)
 - #29139: Fix: CustomerAddressId missing for backend orders (by @engcom-Echo)
 - #28930: Support cron expressions like `3/10 * * * *` and handle hyphen expres… (by @AntonEvers)
 - #29135: [MFTF] use actionGroup click next button on checkout (by @Usik2203)
 - #28992: PageCache / Layout: Avoid multiple calls and config fetch (by @lbajsarowicz)
 - #27537: Add validation phone field on checkout page (by @Usik2203)
 - #23972: fixed disabled guest checkout issue in case of downloadable product  (by @rani-webkul)
 - #28842: Cover form email component in checkout page with jasmine test (by @mrtuvn)
 - #29244: Fix unit tests with PHPUnit 9 errors (by @AntonEvers)
 - #26032: #7213 prevent pointless session start in webapi scope (by @maqlec)


Fixed GitHub Issues:
 - #29308: [Issue] improve NonComposerComponentRegistration (reported by @m2-assistant[bot]) has been fixed in #28975 by @rvitaliy in 2.4-develop branch
   Related commits:
     1. 8e45616

 - #29283: [Issue] Unit Test / Bugfix / Inverted Expected value with actual one (reported by @m2-assistant[bot]) has been fixed in #29271 by @lbajsarowicz in 2.4-develop branch
   Related commits:
     1. ff0e8f6

 - #28793: Magento 2 CustomerAddressId missing for backend orders (reported by @boseasha) has been fixed in #29139 by @engcom-Echo in 2.4-develop branch
   Related commits:
     1. c899815

 - #29240: [Issue] Support cron expressions like `3/10 * * * *` and handle hyphen expres� (reported by @m2-assistant[bot]) has been fixed in #28930 by @AntonEvers in 2.4-develop branch
   Related commits:
     1. 6dd0bb6
     2. ce87ede

 - #29159: [Issue] PageCache / Layout: Avoid multiple calls and config fetch (reported by @m2-assistant[bot]) has been fixed in #28992 by @lbajsarowicz in 2.4-develop branch
   Related commits:
     1. b59dc72

 - #28800: [Issue] Add validation phone field on checkout page (reported by @m2-assistant[bot]) has been fixed in #27537 by @Usik2203 in 2.4-develop branch
   Related commits:
     1. c54b8f3
     2. 196e423
     3. f951152
     4. f5c2575
     5. 42889f8
     6. d9f626d
     7. 9706369
     8. 0433c82
     9. 3afe988
     10. 15ceda0
     11. a692863
     12. 95be243

 - #23971: Disable Guest Checkout if Cart Contains Downloadable Items doesn't work correctly (reported by @rani-webkul) has been fixed in #23972 by @rani-webkul in 2.4-develop branch
   Related commits:
     1. 548ea7b
     2. 1cf1389
     3. 65cf71b
     4. a1dd986
     5. c3e1ce0
     6. caf9ef7
     7. 98dd6c0
     8. 9f37b2f
     9. 993a1e5
     10. 575d9e5
     11. c343492
     12. 4d045cd
     13. 05a3348
     14. 9e9bc69
     15. 4380ff6
     16. f4eb33e
     17. 11f21bf
     18. 59e7f33
     19. 49e2fa9
     20. 5389a71
     21. 938a68c
     22. 08e3875
     23. 4c50949
     24. af4b740
     25. 592915d
     26. 4dac91c
     27. 4db0172
     28. f1e11ea
     29. 88778bd
     30. 63ad4a3
     31. 88953ac
     32. 11e34b3

 - #29329: [Issue] Fix unit tests with PHPUnit 9 errors (reported by @m2-assistant[bot]) has been fixed in #29244 by @AntonEvers in 2.4-develop branch
   Related commits:
     1. 86000ce
     2. 48f5a92

 - #7213: WEBAPI: PHP session is always started 2.1.2 (reported by @boldhedgehog) has been fixed in #26032 by @maqlec in 2.4-develop branch
   Related commits:
     1. 859307b
     2. 8aed39f
     3. 4a05e78
     4. cfa889e
     5. b219c4e
     6. c5ad40b
     7. fe0bd17
     8. ac0dea5
     9. ea10595
     10. b4a02dd
     11. 4f20656
     12. 192bc7e
     13. f149763
     14. ac0f4e6
     15. 3e833b3
     16. c1f5509
     17. edd0ccd
     18. 4dac67d
     19. 97b235d
     20. 16797c3
  • Loading branch information
slavvka authored Aug 1, 2020
2 parents 12cdc54 + 5cde169 commit ae5cf1e
Show file tree
Hide file tree
Showing 45 changed files with 634 additions and 165 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class AjaxLoginTest extends TestCase
/**
* @var array
*/
protected $formIds;
protected $formIds = ['user_login'];

/**
* @var AjaxLogin
Expand Down Expand Up @@ -97,7 +97,6 @@ protected function setUp(): void
->method('getCaptcha')
->willReturn($this->captchaMock);

$this->formIds = ['user_login'];
$this->serializerMock = $this->createMock(Json::class);

$this->model = new AjaxLogin(
Expand Down Expand Up @@ -194,7 +193,10 @@ public function testAroundExecuteCaptchaIsNotRequired($username, $requestContent

$this->captchaMock->expects($this->once())->method('isRequired')->with($username)
->willReturn(false);
$this->captchaMock->expects($this->never())->method('logAttempt')->with($username);
$expectLogAttempt = $requestContent['captcha_form_id'] ?? false;
$this->captchaMock
->expects($expectLogAttempt ? $this->once() : $this->never())
->method('logAttempt')->with($username);
$this->captchaMock->expects($this->never())->method('isCorrect');

$closure = function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,7 @@

<!--Select shipping method-->
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
<waitForElementVisible selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterClickNext"/>
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
<!--Select payment method-->
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod"/>
<!-- Place Order -->
Expand Down Expand Up @@ -257,9 +255,7 @@

<!--Select shipping method-->
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod2"/>
<waitForElementVisible selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton2"/>
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext2"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterClickNext2"/>
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext2"/>

<!--Select payment method-->
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod2"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@
<see selector="{{CheckoutPaymentSection.ProductOptionsActiveByProductItemName($$createProduct.name$$)}}" userInput="1:00 AM" stepKey="seeProductOptionTimeInput" />
<!--Select shipping method-->
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterClickNext"/>
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
<!--Select payment method-->
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectPaymentMethod"/>
<!-- Place Order -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@
<!--Select shipping method-->

<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRateShippingMethod"/>
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskAfterClickNext"/>
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>

<!-- Checkout select Check/Money Order payment -->
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@
<waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/>
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="goToShoppingCartPage"/>
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
<waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/>
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
<!-- Checkout select Check/Money Order payment -->
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
Expand Down
3 changes: 3 additions & 0 deletions app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,9 @@ private function getBillingAddressComponent($paymentCode, $elements)
],
],
'telephone' => [
'validation' => [
'validate-phoneStrict' => 0,
],
'config' => [
'tooltip' => [
'description' => __('For delivery questions.'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
<fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{UK_Address.telephone}}" stepKey="enterTelephone"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
<click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
<seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@
<waitForPageLoad stepKey="waitForAddressSaving"/>

<!-- Click next button to open payment section -->
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
<waitForPageLoad stepKey="waitForShipmentPageLoad"/>
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>

<!-- Change the address -->
<uncheckOption selector="{{CheckoutPaymentSection.billingAddressNotSameCheckbox}}" stepKey="selectPaymentSolution"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="navigateToCheckoutPage"/>

<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNextButton"/>
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNextButton"/>
<see selector="{{StorefrontMessagesSection.error}}" userInput='Please specify a regionId in shipping address.' stepKey="seeErrorMessages"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@

<!--Select shipping method and finalize checkout-->
<click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
<waitForPageLoad stepKey="waitForShippingMethodLoad"/>
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="clickNext"/>
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
<seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?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="StorefrontOnePageCheckoutPhoneValidationTest">
<annotations>
<features value="Checkout"/>
<stories value="Checkout validation phone field"/>
<title value="Validate phone field on checkout page"/>
<description value="Validate phone field on checkout page, field must not contain alphabetical symbols"/>
<severity value="MAJOR" />
<testCaseId value="MC-35292"/>
</annotations>
<before>
<createData entity="_defaultCategory" stepKey="createCategory"/>
<createData entity="ApiSimpleProduct" stepKey="createProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
</before>
<after>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
</after>

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

<actionGroup ref="StorefrontAddSimpleProductToCartActionGroup" stepKey="addToCartFromStorefrontProductPage">
<argument name="product" value="$$createProduct$$"/>
</actionGroup>

<actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="guestGoToCheckout"/>

<fillField userInput="Sample text" selector="{{CheckoutShippingSection.telephone}}" stepKey="enterAlphabeticalSymbols"/>
<see userInput="Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890." selector="{{CheckoutShippingSection.addressFieldValidationError}}" stepKey="checkPhoneFieldValidationIsPassed"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@
</item>
</item>
<item name="telephone" xsi:type="array">
<item name="validation" xsi:type="array">
<item name="validate-phoneStrict" xsi:type="number">0</item>
</item>
<item name="config" xsi:type="array">
<item name="tooltip" xsi:type="array">
<item name="description" xsi:type="string" translate="true">For delivery questions.</item>
Expand Down
10 changes: 9 additions & 1 deletion app/code/Magento/Cron/Model/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public function matchCronExpression($expr, $num)
}

// handle all match by modulus
$offset = 0;
if ($expr === '*') {
$from = 0;
$to = 60;
Expand All @@ -201,6 +202,13 @@ public function matchCronExpression($expr, $num)

$from = $this->getNumeric($e[0]);
$to = $this->getNumeric($e[1]);
if ($mod !== 1) {
$offset = $from;
}
} elseif ($mod !== 1) {
$offset = $this->getNumeric($expr);
$from = 0;
$to = 60;
} else {
// handle regular token
$from = $this->getNumeric($expr);
Expand All @@ -211,7 +219,7 @@ public function matchCronExpression($expr, $num)
throw new CronException(__('Invalid cron expression: %1', $expr));
}

return $num >= $from && $num <= $to && $num % $mod === 0;
return $num >= $from && $num <= $to && ($num - $offset) % $mod === 0;
}

/**
Expand Down
16 changes: 16 additions & 0 deletions app/code/Magento/Cron/Test/Unit/Model/ScheduleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,24 +128,28 @@ public function setCronExprDataProvider(): array
[', * * * *', [',', '*', '*', '*', '*']],
['1-2 * * * *', ['1-2', '*', '*', '*', '*']],
['0/5 * * * *', ['0/5', '*', '*', '*', '*']],
['3/5 * * * *', ['3/5', '*', '*', '*', '*']],

['* 0 * * *', ['*', '0', '*', '*', '*']],
['* 59 * * *', ['*', '59', '*', '*', '*']],
['* , * * *', ['*', ',', '*', '*', '*']],
['* 1-2 * * *', ['*', '1-2', '*', '*', '*']],
['* 0/5 * * *', ['*', '0/5', '*', '*', '*']],
['* 3/5 * * *', ['*', '3/5', '*', '*', '*']],

['* * 0 * *', ['*', '*', '0', '*', '*']],
['* * 23 * *', ['*', '*', '23', '*', '*']],
['* * , * *', ['*', '*', ',', '*', '*']],
['* * 1-2 * *', ['*', '*', '1-2', '*', '*']],
['* * 0/5 * *', ['*', '*', '0/5', '*', '*']],
['* * 3/5 * *', ['*', '*', '3/5', '*', '*']],

['* * * 1 *', ['*', '*', '*', '1', '*']],
['* * * 31 *', ['*', '*', '*', '31', '*']],
['* * * , *', ['*', '*', '*', ',', '*']],
['* * * 1-2 *', ['*', '*', '*', '1-2', '*']],
['* * * 0/5 *', ['*', '*', '*', '0/5', '*']],
['* * * 3/5 *', ['*', '*', '*', '3/5', '*']],
['* * * ? *', ['*', '*', '*', '?', '*']],
['* * * L *', ['*', '*', '*', 'L', '*']],
['* * * W *', ['*', '*', '*', 'W', '*']],
Expand All @@ -156,6 +160,7 @@ public function setCronExprDataProvider(): array
['* * * * ,', ['*', '*', '*', '*', ',']],
['* * * * 1-2', ['*', '*', '*', '*', '1-2']],
['* * * * 0/5', ['*', '*', '*', '*', '0/5']],
['* * * * 3/5', ['*', '*', '*', '*', '3/5']],
['* * * * JAN', ['*', '*', '*', '*', 'JAN']],
['* * * * DEC', ['*', '*', '*', '*', 'DEC']],
['* * * * JAN-DEC', ['*', '*', '*', '*', 'JAN-DEC']],
Expand All @@ -165,6 +170,7 @@ public function setCronExprDataProvider(): array
['* * * * * ,', ['*', '*', '*', '*', '*', ',']],
['* * * * * 1-2', ['*', '*', '*', '*', '*', '1-2']],
['* * * * * 0/5', ['*', '*', '*', '*', '*', '0/5']],
['* * * * * 3/5', ['*', '*', '*', '*', '*', '3/5']],
['* * * * * ?', ['*', '*', '*', '*', '*', '?']],
['* * * * * L', ['*', '*', '*', '*', '*', 'L']],
['* * * * * 6#3', ['*', '*', '*', '*', '*', '6#3']],
Expand Down Expand Up @@ -372,9 +378,19 @@ public function matchCronExpressionDataProvider(): array
['0-20/5', 21, false],
['0-20/5', 25, false],

['3-20/5', 3, true],
['3-20/5', 8, true],
['3-20/5', 13, true],
['3-20/5', 24, false],
['3-20/5', 28, false],

['1/5', 5, false],
['5/5', 5, true],
['10/5', 10, true],

['4/5', 8, false],
['8/5', 8, true],
['13/5', 13, true],
];
}

Expand Down
8 changes: 4 additions & 4 deletions app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<item>Bld D</item>
</array>
<data key="company">Magento</data>
<data key="telephone">1234568910</data>
<data key="telephone">123-456-7890</data>
<data key="fax">1234568910</data>
<data key="postcode">78729</data>
<data key="city">Austin</data>
Expand Down Expand Up @@ -172,7 +172,7 @@
<data key="city">London</data>
<data key="postcode">SE1 7RW</data>
<data key="country_id">GB</data>
<data key="telephone">444-44-444-44</data>
<data key="telephone">444-444-4444</data>
</entity>
<entity name="US_Address_Utah" type="address">
<data key="firstname">John</data>
Expand Down Expand Up @@ -227,7 +227,7 @@
<data key="firstname">John</data>
<data key="lastname">Doe</data>
<data key="company">Magento</data>
<data key="telephone">0123456789-02134567</data>
<data key="telephone">888-777-7890</data>
<array key="street">
<item>172, Westminster Bridge Rd</item>
<item>7700 xyz street</item>
Expand Down Expand Up @@ -305,7 +305,7 @@
<data key="firstname">Jane</data>
<data key="lastname">Miller</data>
<data key="company">Magento</data>
<data key="telephone">44 20 7123 1234</data>
<data key="telephone">123-456-7899</data>
<array key="street">
<item>1 London Bridge Street</item>
</array>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Customer/etc/webapi_rest/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<arguments>
<argument name="userContexts" xsi:type="array">
<item name="customerSessionUserContext" xsi:type="array">
<item name="type" xsi:type="object">Magento\Customer\Model\Authorization\CustomerSessionUserContext</item>
<item name="type" xsi:type="object">Magento\Customer\Model\Authorization\CustomerSessionUserContext\Proxy</item>
<item name="sortOrder" xsi:type="string">20</item>
</item>
</argument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function testExecuteVsCodeFormat()
->with(
$this->equalTo(['urn:magento:framework:Module/etc/module.xsd' => $fixtureXmlFile]),
$this->equalTo('test')
)->willReturn(null);
);

$formats = ['vscode' => $vscodeFormatMock];
$readFactory = $this->createMock(ReadFactory::class);
Expand Down
Loading

0 comments on commit ae5cf1e

Please sign in to comment.