Skip to content

Commit 9034093

Browse files
authored
Merge pull request #7810 from magento-gl/spartans_pr_04082022
[Spartans] - Bugfix delivery
2 parents e212168 + e01e1a6 commit 9034093

File tree

11 files changed

+266
-3
lines changed

11 files changed

+266
-3
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminFilterProductListByBundleProductInDutchUserLanguageTest">
12+
<annotations>
13+
<features value="Bundle"/>
14+
<stories value="Admin list bundle products when user language is set as Dutch"/>
15+
<title value="Admin should be able to filter product list by type = Bundle Product, when user language is set as Dutch"/>
16+
<description value="Admin should be able to filter product list by type = Bundle Product
17+
wherein the tier price for the bundle product should be set and user language set as Dutch"/>
18+
<severity value="CRITICAL"/>
19+
</annotations>
20+
<before>
21+
<createData entity="SimpleProduct2" stepKey="createProductForBundleItem1">
22+
<field key="price">100.00</field>
23+
</createData>
24+
<createData entity="SimpleProduct2" stepKey="createProductForBundleItem2">
25+
<field key="price">100.00</field>
26+
</createData>
27+
<!-- Enable Changing Locale to Dutch -->
28+
<magentoCLI command="setup:static-content:deploy" arguments="-f nl_NL" stepKey="staticDeployAfterChangeLocaleToNL"/>
29+
<magentoCron groups="index" stepKey="runCronIndex"/>
30+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
31+
</before>
32+
<after>
33+
<deleteData createDataKey="createProductForBundleItem1" stepKey="deleteProductForBundleItem1"/>
34+
<deleteData createDataKey="createProductForBundleItem2" stepKey="deleteProductForBundleItem2"/>
35+
<actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteBundle">
36+
<argument name="product" value="BundleProduct"/>
37+
</actionGroup>
38+
<actionGroup ref="ResetAdminDataGridToDefaultViewActionGroup" stepKey="clearProductsGridFilters"/>
39+
<comment userInput="BIC workaround" stepKey="waitForClearProductsGridFilters"/>
40+
<!-- Change Admin locale to default -->
41+
<actionGroup ref="SetAdminAccountActionGroup" stepKey="setAdminAccountToDefault">
42+
<argument name="InterfaceLocaleByValue" value="en_US" />
43+
</actionGroup>
44+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
45+
</after>
46+
47+
<!-- Change Admin locale to Nederlands (Nederland) / Nederlands (Nederland) -->
48+
<actionGroup ref="SetAdminAccountActionGroup" stepKey="setAdminAccountToDutch">
49+
<argument name="InterfaceLocaleByValue" value="nl_NL" />
50+
</actionGroup>
51+
52+
<!--Create bundle product-->
53+
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToBundleProductCreationPage">
54+
<argument name="attributeSetId" value="{{BundleProduct.set}}"/>
55+
<argument name="productType" value="{{BundleProduct.type}}"/>
56+
</actionGroup>
57+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForBundleProductCreatePageToLoad"/>
58+
<click selector="{{AdminProductFormBundleSection.dynamicSkuToggle}}" stepKey="disableDynamicSku"/>
59+
<click selector="{{AdminProductFormBundleSection.dynamicPrice}}" stepKey="clickDynamicPriceSwitcher"/>
60+
<fillField selector="{{AdminProductFormBundleSection.priceField}}" userInput="100" stepKey="fillBundlePrice"/>
61+
<actionGroup ref="FillMainBundleProductFormActionGroup" stepKey="fillMainFieldsForBundle"/>
62+
<actionGroup ref="AddBundleOptionWithOneProductActionGroup" stepKey="addBundleOption1">
63+
<argument name="x" value="0"/>
64+
<argument name="n" value="1"/>
65+
<argument name="prodOneSku" value="$createProductForBundleItem1.sku$"/>
66+
<argument name="prodTwoSku" value=""/>
67+
<argument name="optionTitle" value="Option1"/>
68+
<argument name="inputType" value="checkbox"/>
69+
</actionGroup>
70+
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYPrice('0', '0')}}" userInput="100" stepKey="fillBundleOption1Price"/>
71+
<selectOption selector="{{AdminProductFormBundleSection.bundlePriceType}}" userInput="Percent" stepKey="selectPercentPrice"/>
72+
<actionGroup ref="AddBundleOptionWithOneProductActionGroup" stepKey="addBundleOption2">
73+
<argument name="x" value="1"/>
74+
<argument name="n" value="2"/>
75+
<argument name="prodOneSku" value="$createProductForBundleItem2.sku$"/>
76+
<argument name="prodTwoSku" value=""/>
77+
<argument name="optionTitle" value="Option2"/>
78+
<argument name="inputType" value="checkbox"/>
79+
</actionGroup>
80+
<fillField selector="{{AdminProductFormBundleSection.bundleOptionXProductYPrice('1', '0')}}" userInput="100" stepKey="fillBundleOption2Price"/>
81+
<scrollToTopOfPage stepKey="scrollToTopOfTheProductPage"/>
82+
<actionGroup ref="AdminBundleProductSetAdvancedPricingActionGroup" stepKey="addProductTierPrice">
83+
<argument name="quantity" value="1"/>
84+
<argument name="price" value="Discount"/>
85+
<argument name="amount" value="50"/>
86+
<argument name="priceView" value="As Low as"/>
87+
</actionGroup>
88+
89+
<!--Save the product-->
90+
<actionGroup ref="AdminProductFormSaveActionGroup" stepKey="clickSaveButton"/>
91+
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="messageYouSavedTheProductIsShown"/>
92+
93+
<!--Apply Bundle Product Filter-->
94+
<!--Clear Filters-->
95+
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="ClearFilters"/>
96+
97+
<!--Setting filter-->
98+
<actionGroup ref="BundleProductFilter" stepKey="FilterForOnlyBundleProducts"/>
99+
100+
<!--Testing application of filter-->
101+
<see selector="{{AdminProductFiltersSection.productType('0')}}" userInput="Bundle Product" stepKey="correcType0"/>
102+
<dontSeeElement selector="{{AdminProductFiltersSection.AllProductsNotOfBundleType}}" stepKey="checkingRowsForIncorrectType"/>
103+
</test>
104+
</tests>

app/code/Magento/Bundle/Ui/DataProvider/Product/Modifier/SpecialPriceAttributes.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
*/
2020
class SpecialPriceAttributes implements ModifierInterface
2121
{
22+
public const LOCALE_USING_DECIMAL_COMMA = ['nl_BE', 'nl_NL'];
23+
2224
/**
2325
* @var ResolverInterface
2426
*/
@@ -73,6 +75,9 @@ public function modifyData(array $data): array
7375
['display' => CurrencyData::NO_SYMBOL],
7476
false
7577
);
78+
if (in_array($this->localeResolver->getLocale(), self::LOCALE_USING_DECIMAL_COMMA)) {
79+
$item[$priceAttribute] = str_replace(['.',','], ['','.'], $item[$priceAttribute]);
80+
}
7681
$item[$priceAttribute] = $numberFormatter->format($item[$priceAttribute] / 100);
7782
}
7883
}

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest/StorefrontCustomerCheckoutTestWithRestrictedCountriesForPaymentTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<createData entity="ApiSimpleProduct" stepKey="createProduct">
2323
<requiredEntity createDataKey="createCategory"/>
2424
</createData>
25+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
2526
<magentoCLI command="config:set checkout/options/display_billing_address_on 1" stepKey="setShowBillingAddressOnPaymentPage"/>
2627
<magentoCLI command="config:set payment/checkmo/allowspecific 1" stepKey="allowSpecificValue"/>
2728
<magentoCLI command="config:set payment/checkmo/specificcountry GB" stepKey="specificCountryValue"/>

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,9 @@ public function resetPassword($email, $resetToken, $newPassword)
726726
$customerSecure->setRpToken(null);
727727
$customerSecure->setRpTokenCreatedAt(null);
728728
$customerSecure->setPasswordHash($this->createPasswordHash($newPassword));
729+
$customerSecure->setFailuresNum(0);
730+
$customerSecure->setFirstFailure(null);
731+
$customerSecure->setLockExpires(null);
729732
$this->sessionCleaner->clearFor((int)$customer->getId());
730733
$this->customerRepository->save($customer);
731734

@@ -1216,6 +1219,7 @@ public function isReadonly($customerId)
12161219
* @return $this
12171220
* @throws LocalizedException
12181221
* @deprecated 100.1.0
1222+
* @see MAGETWO-71174
12191223
*/
12201224
protected function sendNewAccountEmail(
12211225
$customer,
@@ -1259,6 +1263,7 @@ protected function sendNewAccountEmail(
12591263
* @throws LocalizedException
12601264
* @throws NoSuchEntityException
12611265
* @deprecated 100.1.0
1266+
* @see MAGETWO-71174
12621267
*/
12631268
protected function sendPasswordResetNotificationEmail($customer)
12641269
{
@@ -1272,6 +1277,7 @@ protected function sendPasswordResetNotificationEmail($customer)
12721277
* @param int|string|null $defaultStoreId
12731278
* @return int
12741279
* @deprecated 100.1.0
1280+
* @see MAGETWO-71174
12751281
* @throws LocalizedException
12761282
*/
12771283
protected function getWebsiteStoreId($customer, $defaultStoreId = null)
@@ -1289,6 +1295,7 @@ protected function getWebsiteStoreId($customer, $defaultStoreId = null)
12891295
*
12901296
* @return array
12911297
* @deprecated 100.1.0
1298+
* @see MAGETWO-71174
12921299
*/
12931300
protected function getTemplateTypes()
12941301
{
@@ -1322,6 +1329,7 @@ protected function getTemplateTypes()
13221329
* @return $this
13231330
* @throws MailException
13241331
* @deprecated 100.1.0
1332+
* @see MAGETWO-71174
13251333
*/
13261334
protected function sendEmailTemplate(
13271335
$customer,
@@ -1476,6 +1484,7 @@ public function changeResetPasswordLinkToken(CustomerInterface $customer, string
14761484
* @throws LocalizedException
14771485
* @throws NoSuchEntityException
14781486
* @deprecated 100.1.0
1487+
* @see MAGETWO-71174
14791488
*/
14801489
public function sendPasswordReminderEmail($customer)
14811490
{
@@ -1505,6 +1514,7 @@ public function sendPasswordReminderEmail($customer)
15051514
* @throws LocalizedException
15061515
* @throws NoSuchEntityException
15071516
* @deprecated 100.1.0
1517+
* @see MAGETWO-71174
15081518
*/
15091519
public function sendPasswordResetConfirmationEmail($customer)
15101520
{
@@ -1550,6 +1560,7 @@ protected function getAddressById(CustomerInterface $customer, $addressId)
15501560
* @return Data\CustomerSecure
15511561
* @throws NoSuchEntityException
15521562
* @deprecated 100.1.0
1563+
* @see MAGETWO-71174
15531564
*/
15541565
protected function getFullCustomerObject($customer)
15551566
{
@@ -1595,6 +1606,7 @@ private function disableAddressValidation($customer)
15951606
*
15961607
* @return EmailNotificationInterface
15971608
* @deprecated 100.1.0
1609+
* @see MAGETWO-71174
15981610
*/
15991611
private function getEmailNotification()
16001612
{

app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,10 @@ private function reInitModel(): void
18201820
'getPasswordHash',
18211821
'setPasswordHash',
18221822
'setRpToken',
1823-
'setRpTokenCreatedAt'
1823+
'setRpTokenCreatedAt',
1824+
'setFailuresNum',
1825+
'setFirstFailure',
1826+
'setLockExpires',
18241827
]
18251828
)
18261829
->getMock();
@@ -2039,6 +2042,9 @@ function ($string) {
20392042
$this->customerSecure->expects($this->once())->method('setRpToken')->with(null);
20402043
$this->customerSecure->expects($this->once())->method('setRpTokenCreatedAt')->with(null);
20412044
$this->customerSecure->expects($this->any())->method('setPasswordHash')->willReturn(null);
2045+
$this->customerSecure->expects($this->once())->method('setFailuresNum')->with(0);
2046+
$this->customerSecure->expects($this->once())->method('setFirstFailure')->with(null);
2047+
$this->customerSecure->expects($this->once())->method('setLockExpires')->with(null);
20422048
$this->sessionCleanerMock->expects($this->once())->method('clearFor')->with($customerId)->willReturnSelf();
20432049

20442050
$this->assertTrue($this->accountManagement->resetPassword($customerEmail, $resetToken, $newPassword));

app/code/Magento/PaypalCaptcha/Test/Mftf/Test/StorefrontPaymentsCaptchaWithPayflowProTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<group value="captcha"/>
2121
</annotations>
2222
<before>
23+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
2324
<!-- Configure Paypal Payflow Pro payment method -->
2425
<createData entity="PaypalPayflowProConfig" stepKey="configurePaypalPayflowProPayment"/>
2526
<createData entity="EnablePaypalPayflowProWithVault" stepKey="enablePaypalPayflowProPaymentWithVault"/>

app/code/Magento/Sales/Model/ResourceModel/Order/Handler/State.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public function check(Order $order)
4141
} elseif ($currentState === Order::STATE_PROCESSING && !$order->canShip()) {
4242
$order->setState(Order::STATE_COMPLETE)
4343
->setStatus($order->getConfig()->getStateDefaultStatus(Order::STATE_COMPLETE));
44+
} elseif ($order->getIsVirtual() && $order->getStatus() === Order::STATE_CLOSED) {
45+
$order->setState(Order::STATE_CLOSED);
4446
}
4547
}
4648
return $this;

app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderCommentWithHTMLTagsDisplayTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<group value="Sales"/>
2121
</annotations>
2222
<before>
23+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
2324
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
2425
<createData entity="SimpleProduct2" stepKey="createProduct"/>
2526
<createData entity="CustomerCart" stepKey="createCustomerCart">

app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Order/Handler/StateTest.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ protected function setUp(): void
4242
'canCreditmemo',
4343
'getTotalRefunded',
4444
'getConfig',
45-
'getIsNotVirtual'
45+
'getIsVirtual',
46+
'getIsNotVirtual',
47+
'getStatus',
4648
]
4749
)
4850
->disableOriginalConstructor()
@@ -102,6 +104,12 @@ public function testCheck(
102104
->willReturn($isInProcess);
103105
$this->orderMock->method('getIsNotVirtual')
104106
->willReturn($isNotVirtual);
107+
if (!$isNotVirtual) {
108+
$this->orderMock->method('getIsVirtual')
109+
->willReturn(!$isNotVirtual);
110+
$this->orderMock->method('getStatus')
111+
->willReturn($expectedState);
112+
}
105113
$this->state->check($this->orderMock);
106114
$this->assertEquals($expectedState, $this->orderMock->getState());
107115
}
@@ -323,6 +331,19 @@ public function stateCheckDataProvider()
323331
'can_unhold' => false,
324332
'is_not_virtual' => false
325333
],
334+
'complete - !canCreditmemo, !canShip - closed(virtual product)' => [
335+
'can_credit_memo' => false,
336+
'can_credit_memo_invoke_count' => 1,
337+
'can_ship' => false,
338+
'call_can_skip_num' => 1,
339+
'current_state' => Order::STATE_COMPLETE,
340+
'expected_state' => Order::STATE_CLOSED,
341+
'is_in_process' => false,
342+
'get_is_in_process_invoke_count' => 0,
343+
'is_canceled' => false,
344+
'can_unhold' => false,
345+
'is_not_virtual' => false,
346+
],
326347
];
327348
}
328349
}

0 commit comments

Comments
 (0)