Skip to content

Commit 14cbe5b

Browse files
committed
Merge remote-tracking branch 'mainline/2.3-develop' into MQE-1496
2 parents 79df0e2 + 079bdf0 commit 14cbe5b

File tree

72 files changed

+2477
-512
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2477
-512
lines changed

app/code/Magento/Braintree/Model/LocaleResolver.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Magento\Framework\Locale\ResolverInterface;
99
use Magento\Braintree\Gateway\Config\PayPal\Config;
1010

11+
/**
12+
* Resolves locale for PayPal Express.
13+
*/
1114
class LocaleResolver implements ResolverInterface
1215
{
1316
/**
@@ -20,6 +23,17 @@ class LocaleResolver implements ResolverInterface
2023
*/
2124
private $config;
2225

26+
/**
27+
* Mapping Magento locales on PayPal locales.
28+
*
29+
* @var array
30+
*/
31+
private $localeMap = [
32+
'zh_Hans_CN' => 'zh_CN',
33+
'zh_Hant_HK' => 'zh_HK',
34+
'zh_Hant_TW' => 'zh_TW'
35+
];
36+
2337
/**
2438
* @param ResolverInterface $resolver
2539
* @param Config $config
@@ -66,10 +80,11 @@ public function setLocale($locale = null)
6680
* Gets store's locale or the `en_US` locale if store's locale does not supported by PayPal.
6781
*
6882
* @return string
83+
* @see https://braintree.github.io/braintree-web/current/PayPalCheckout.html#createPayment
6984
*/
7085
public function getLocale()
7186
{
72-
$locale = $this->resolver->getLocale();
87+
$locale = $this->localeMap[$this->resolver->getLocale()] ?? $this->resolver->getLocale();
7388
$allowedLocales = $this->config->getValue('supported_locales');
7489

7590
return strpos($allowedLocales, $locale) !== false ? $locale : 'en_US';

app/code/Magento/Braintree/Test/Mftf/Data/BraintreeData.xml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
*/
77
-->
88

9-
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
9+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
1110
<entity name="SampleBraintreeConfig" type="braintree_config_state">
1211
<requiredEntity type="title">SampleTitle</requiredEntity>
1312
<requiredEntity type="payment_action">SamplePaymentAction</requiredEntity>
@@ -54,13 +53,13 @@
5453
<data key="value">sandbox</data>
5554
</entity>
5655
<entity name="MerchantId" type="merchant_id">
57-
<data key="value">d4pdjhxgjfrsmzbf</data>
56+
<data key="value">MERCH_ID</data>
5857
</entity>
5958
<entity name="PublicKey" type="public_key">
60-
<data key="value">m7q4wmh43xrgyrst</data>
59+
<data key="value">PUBLIC_KEY</data>
6160
</entity>
6261
<entity name="PrivateKey" type="private_key">
63-
<data key="value">67de364080b1b4e2492d7a3de413a572</data>
62+
<data key="value">PRIVATE_KEY</data>
6463
</entity>
6564

6665
<!-- default configuration used to restore Magento config -->
@@ -138,14 +137,17 @@
138137
<data key="year">20</data>
139138
<data key="cvv">113</data>
140139
</entity>
140+
<entity name="StoredPaymentMethods">
141+
<data key="cardNumberEnding">5100</data>
142+
<data key="cardExpire">12/2020</data>
143+
</entity>
141144

142145
<entity name="BraintreeConfigurationData" type="data">
143146
<data key="title">Credit Card (Braintree)</data>
144-
<data key="merchantID">d4pdjhxgjfrsmzbf</data>
145-
<data key="publicKey">m7q4wmh43xrgyrst</data>
146-
<data key="privateKey">67de364080b1b4e2492d7a3de413a572</data>
147-
<data key="merchantAccountID">Magneto</data>
147+
<data key="merchantID">MERCH_ID</data>
148+
<data key="publicKey">PUBLIC_KEY</data>
149+
<data key="privateKey">PRIVATE_KEY</data>
150+
<data key="merchantAccountID">MERCH_ACCOUNT_ID</data>
148151
<data key="titleForPayPalThroughBraintree">PayPal (Braintree)</data>
149152
</entity>
150-
151153
</entities>

app/code/Magento/Braintree/Test/Mftf/Test/BraintreeCreditCardOnCheckoutTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<severity value="MAJOR"/>
1818
<testCaseId value="MAGETWO-93767"/>
1919
<group value="braintree"/>
20+
<skip>
21+
<issueId value="MQE-1576"/>
22+
</skip>
2023
</annotations>
2124

2225
<before>

app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MAGETWO-93677"/>
1919
<group value="braintree"/>
20+
<skip>
21+
<issueId value="MQE-1576"/>
22+
</skip>
2023
</annotations>
2124

2225

app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MAGETWO-94472"/>
1919
<group value="braintree"/>
20+
<skip>
21+
<issueId value="MQE-1576"/>
22+
</skip>
2023
</annotations>
2124

2225
<before>

app/code/Magento/Braintree/Test/Unit/Model/LocaleResolverTest.php

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,35 @@ public function testSetLocale()
9898
/**
9999
* Test getLocale method
100100
*
101-
* @return void
101+
* @param string $locale
102+
* @param string $expectedLocale
103+
* @dataProvider getLocaleDataProvider
102104
*/
103-
public function testGetLocale()
105+
public function testGetLocale(string $locale, string $expectedLocale)
104106
{
105-
$locale = 'en_TEST';
106-
$allowedLocales = 'en_US,en_GB,en_AU,da_DK,fr_FR,fr_CA,de_DE,zh_HK,it_IT,nl_NL';
107-
$this->resolverMock->expects($this->once())->method('getLocale')->willReturn($locale);
108-
$this->configMock->expects($this->once())->method('getValue')->with('supported_locales')
107+
$allowedLocales = 'en_US,en_GB,en_AU,da_DK,fr_FR,fr_CA,de_DE,zh_HK,it_IT,zh_CN,zh_TW,nl_NL';
108+
$this->resolverMock->method('getLocale')
109+
->willReturn($locale);
110+
$this->configMock->method('getValue')
111+
->with('supported_locales')
109112
->willReturn($allowedLocales);
110-
111-
$expected = 'en_US';
112113
$actual = $this->localeResolver->getLocale();
113-
self::assertEquals($expected, $actual);
114+
115+
self::assertEquals($expectedLocale, $actual);
116+
}
117+
118+
/**
119+
* @return array
120+
*/
121+
public function getLocaleDataProvider(): array
122+
{
123+
return [
124+
['locale' => 'zh_Hans_CN', 'expectedLocale' => 'zh_CN'],
125+
['locale' => 'zh_Hant_HK', 'expectedLocale' => 'zh_HK'],
126+
['locale' => 'zh_Hant_TW', 'expectedLocale' => 'zh_TW'],
127+
['locale' => 'fr_FR', 'expectedLocale' => 'fr_FR'],
128+
['locale' => 'unknown', 'expectedLocale' => 'en_US'],
129+
];
114130
}
115131

116132
/**
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Model\Category;
9+
10+
use Magento\Catalog\Api\CategoryRepositoryInterface;
11+
use Magento\Catalog\Model\Category;
12+
use Magento\Store\Api\GroupRepositoryInterface;
13+
14+
/**
15+
* Fetcher for associated with store group categories.
16+
*/
17+
class StoreCategories
18+
{
19+
/**
20+
* @var CategoryRepositoryInterface
21+
*/
22+
private $categoryRepository;
23+
24+
/**
25+
* @var GroupRepositoryInterface
26+
*/
27+
private $groupRepository;
28+
29+
/**
30+
* @param CategoryRepositoryInterface $categoryRepository
31+
* @param GroupRepositoryInterface $groupRepository
32+
*/
33+
public function __construct(
34+
CategoryRepositoryInterface $categoryRepository,
35+
GroupRepositoryInterface $groupRepository
36+
) {
37+
$this->categoryRepository = $categoryRepository;
38+
$this->groupRepository = $groupRepository;
39+
}
40+
41+
/**
42+
* Get all category ids for store.
43+
*
44+
* @param int|null $storeGroupId
45+
* @return int[]
46+
* @throws \Magento\Framework\Exception\NoSuchEntityException
47+
*/
48+
public function getCategoryIds(?int $storeGroupId = null): array
49+
{
50+
$rootCategoryId = $storeGroupId
51+
? $this->groupRepository->get($storeGroupId)->getRootCategoryId()
52+
: Category::TREE_ROOT_ID;
53+
/** @var Category $rootCategory */
54+
$rootCategory = $this->categoryRepository->get($rootCategoryId);
55+
$categoriesIds = array_map(
56+
function ($value) {
57+
return (int) $value;
58+
},
59+
(array) $rootCategory->getAllChildren(true)
60+
);
61+
62+
return $categoriesIds;
63+
}
64+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminChangeProductSEOSettingsActionGroup">
12+
<arguments>
13+
<argument name="productName" defaultValue="_defaultProduct.name"/>
14+
</arguments>
15+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="clickSearchEngineOptimizationTab"/>
16+
<waitForPageLoad stepKey="waitForTabOpen"/>
17+
<fillField selector="{{AdminProductSEOSection.urlKeyInput}}" userInput="{{productName}}" stepKey="setUrlKeyInput"/>
18+
<fillField selector="{{AdminProductSEOSection.metaTitleInput}}" userInput="{{productName}}" stepKey="setMetaTitleInput"/>
19+
<fillField selector="{{AdminProductSEOSection.metaKeywordsInput}}" userInput="{{productName}}" stepKey="setMetaKeywordsInput"/>
20+
<fillField selector="{{AdminProductSEOSection.metaDescriptionInput}}" userInput="{{productName}}" stepKey="setMetaDescriptionInput"/>
21+
</actionGroup>
22+
</actionGroups>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminSetProductDesignSettingsActionGroup">
12+
<arguments>
13+
<argument name="designSettings" defaultValue="simpleBlankDesign"/>
14+
</arguments>
15+
<click selector="{{ProductDesignSection.DesignTab}}" stepKey="clickDesignTab"/>
16+
<waitForPageLoad stepKey="waitForTabOpen"/>
17+
<selectOption selector="{{ProductDesignSection.LayoutDropdown}}" userInput="{{designSettings.page_layout}}" stepKey="setLayout"/>
18+
<selectOption selector="{{ProductDesignSection.productOptionsContainer}}" userInput="{{designSettings.options_container}}" stepKey="setDisplayProductOptions"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminSwitchProductGiftMessageStatusActionGroup">
12+
<arguments>
13+
<argument name="status" defaultValue="0"/>
14+
</arguments>
15+
<click selector="{{AdminProductGiftOptionsSection.giftOptions}}" stepKey="clickToExpandGiftOptionsTab"/>
16+
<waitForPageLoad stepKey="waitForGiftOptionsOpen"/>
17+
<uncheckOption selector="{{AdminProductGiftOptionsSection.useConfigSettingsMessage}}" stepKey="uncheckConfigSettingsMessage"/>
18+
<click selector="{{AdminProductGiftOptionsSection.toggleProductGiftMessage}}" stepKey="clickToGiftMessageSwitcher"/>
19+
<seeElement selector="{{AdminProductGiftOptionsSection.giftMessageStatus('status')}}" stepKey="assertGiftMessageStatus"/>
20+
</actionGroup>
21+
</actionGroups>

0 commit comments

Comments
 (0)