Skip to content

Commit 23bd4d6

Browse files
Merge pull request #4940 from magento-engcom/2.3-develop-expedited-prs
[Magento Community Engineering] Community Contributions - 2.3-develop expedited
2 parents 65763df + eddfd51 commit 23bd4d6

26 files changed

+769
-30
lines changed

app/code/Magento/Braintree/Model/Ui/ConfigProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,12 @@ public function __construct(
6767
public function getConfig()
6868
{
6969
$storeId = $this->session->getStoreId();
70+
$isActive = $this->config->isActive($storeId);
7071
return [
7172
'payment' => [
7273
self::CODE => [
73-
'isActive' => $this->config->isActive($storeId),
74-
'clientToken' => $this->getClientToken(),
74+
'isActive' => $isActive,
75+
'clientToken' => $isActive ? $this->getClientToken() : null,
7576
'ccTypesMapper' => $this->config->getCcTypesMapper(),
7677
'sdkUrl' => $this->config->getSdkUrl(),
7778
'hostedFieldsSdkUrl' => $this->config->getHostedFieldsSdkUrl(),

app/code/Magento/Braintree/Test/Unit/Model/Ui/ConfigProviderTest.php

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,30 +76,45 @@ protected function setUp()
7676
}
7777

7878
/**
79-
* Run test getConfig method
79+
* Ensure that get config returns correct data if payment is active or not
8080
*
8181
* @param array $config
8282
* @param array $expected
8383
* @dataProvider getConfigDataProvider
8484
*/
8585
public function testGetConfig($config, $expected)
8686
{
87-
$this->braintreeAdapter->expects(static::once())
88-
->method('generate')
89-
->willReturn(self::CLIENT_TOKEN);
87+
if ($config['isActive']) {
88+
$this->braintreeAdapter->expects($this->once())
89+
->method('generate')
90+
->willReturn(self::CLIENT_TOKEN);
91+
} else {
92+
$config = array_replace_recursive(
93+
$this->getConfigDataProvider()[0]['config'],
94+
$config
95+
);
96+
$expected = array_replace_recursive(
97+
$this->getConfigDataProvider()[0]['expected'],
98+
$expected
99+
);
100+
$this->braintreeAdapter->expects($this->never())
101+
->method('generate');
102+
}
90103

91104
foreach ($config as $method => $value) {
92-
$this->config->expects(static::once())
105+
$this->config->expects($this->once())
93106
->method($method)
94107
->willReturn($value);
95108
}
96109

97-
static::assertEquals($expected, $this->configProvider->getConfig());
110+
$this->assertEquals($expected, $this->configProvider->getConfig());
98111
}
99112

100113
/**
101-
* @covers \Magento\Braintree\Model\Ui\ConfigProvider::getClientToken
114+
* @covers \Magento\Braintree\Model\Ui\ConfigProvider::getClientToken
102115
* @dataProvider getClientTokenDataProvider
116+
* @param $merchantAccountId
117+
* @param $params
103118
*/
104119
public function testGetClientToken($merchantAccountId, $params)
105120
{
@@ -124,7 +139,7 @@ public function getConfigDataProvider()
124139
[
125140
'config' => [
126141
'isActive' => true,
127-
'getCcTypesMapper' => ['visa' => 'VI', 'american-express'=> 'AE'],
142+
'getCcTypesMapper' => ['visa' => 'VI', 'american-express' => 'AE'],
128143
'getSdkUrl' => self::SDK_URL,
129144
'getHostedFieldsSdkUrl' => 'https://sdk.com/test.js',
130145
'getCountrySpecificCardTypeConfig' => [
@@ -148,7 +163,7 @@ public function getConfigDataProvider()
148163
'ccTypesMapper' => ['visa' => 'VI', 'american-express' => 'AE'],
149164
'sdkUrl' => self::SDK_URL,
150165
'hostedFieldsSdkUrl' => 'https://sdk.com/test.js',
151-
'countrySpecificCardTypes' =>[
166+
'countrySpecificCardTypes' => [
152167
'GB' => ['VI', 'AE'],
153168
'US' => ['DI', 'JCB']
154169
],
@@ -166,6 +181,19 @@ public function getConfigDataProvider()
166181
]
167182
]
168183
]
184+
],
185+
[
186+
'config' => [
187+
'isActive' => false,
188+
],
189+
'expected' => [
190+
'payment' => [
191+
ConfigProvider::CODE => [
192+
'isActive' => false,
193+
'clientToken' => null,
194+
]
195+
]
196+
]
169197
]
170198
];
171199
}

app/code/Magento/CatalogUrlRewrite/Observer/CategoryUrlPathAutogeneratorObserver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
9494
$resultUrlKey = $this->categoryUrlPathGenerator->getUrlKey($category);
9595
$this->updateUrlKey($category, $resultUrlKey);
9696
} elseif ($useDefaultAttribute) {
97-
if (!$category->isObjectNew()) {
97+
if (!$category->isObjectNew() && $category->getStoreId() === Store::DEFAULT_STORE_ID) {
9898
$resultUrlKey = $category->formatUrlKey($category->getOrigData('name'));
9999
$this->updateUrlKey($category, $resultUrlKey);
100100
}

app/code/Magento/CatalogUrlRewrite/Test/Unit/Observer/CategoryUrlPathAutogeneratorObserverTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ public function testShouldThrowExceptionIfUrlKeyIsEmpty($useDefaultUrlKey, $isOb
159159
$this->expectExceptionMessage('Invalid URL key');
160160
$categoryData = ['use_default' => ['url_key' => $useDefaultUrlKey], 'url_key' => '', 'url_path' => ''];
161161
$this->category->setData($categoryData);
162+
$this->category
163+
->method('getStoreId')
164+
->willReturn(\Magento\Store\Model\Store::DEFAULT_STORE_ID);
162165
$this->category->isObjectNew($isObjectNew);
163166
$this->assertEquals($isObjectNew, $this->category->isObjectNew());
164167
$this->assertEquals($categoryData['url_key'], $this->category->getUrlKey());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
<!-- Check Default Value for Disable Automatic Group Changes Based on VAT ID in Customer Form -->
12+
<actionGroup name="AdminAssertDefaultValueDisableAutoGroupInCustomerFormActionGroup">
13+
<annotations>
14+
<description>Check Default Value for Disable Automatic Group Changes Based on VAT ID in Create Customer form.</description>
15+
</annotations>
16+
<arguments>
17+
<argument name="isChecked" type="string"/>
18+
</arguments>
19+
20+
<grabValueFrom selector="{{AdminCustomerAccountInformationSection.disableAutomaticGroupChange}}" stepKey="grabDisableAutomaticGroupChange"/>
21+
<assertEquals stepKey="assertDisableAutomaticGroupChangeNo" message="pass">
22+
<expectedResult type="string">{{isChecked}}</expectedResult>
23+
<actualResult type="variable">grabDisableAutomaticGroupChange</actualResult>
24+
</assertEquals>
25+
</actionGroup>
26+
</actionGroups>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="AdminNavigateNewCustomerActionGroup">
12+
<annotations>
13+
<description>Goes to the New Customer page.</description>
14+
</annotations>
15+
16+
<amOnPage url="{{AdminNewCustomerPage.url}}" stepKey="navigateToCustomers"/>
17+
<waitForPageLoad stepKey="waitForLoad"/>
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountInformationSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<element name="firstName" type="input" selector="input[name='customer[firstname]']"/>
1818
<element name="lastName" type="input" selector="input[name='customer[lastname]']"/>
1919
<element name="email" type="input" selector="input[name='customer[email]']"/>
20+
<element name="disableAutomaticGroupChange" type="input" selector="input[name='customer[disable_auto_group_change]']"/>
2021
<element name="group" type="select" selector="[name='customer[group_id]']"/>
2122
<element name="groupIdValue" type="text" selector="//*[@name='customer[group_id]']/option"/>
2223
<element name="groupValue" type="button" selector="//span[text()='{{groupValue}}']" parameterized="true"/>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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="AdminCheckDefaultValueDisableAutoGroupChangeIsNoTest">
12+
<annotations>
13+
<features value="Customer"/>
14+
<stories value="Default Value for Disable Automatic Group Changes Based on VAT ID"/>
15+
<title value="Check settings Default Value for Disable Automatic Group Changes Based on VAT ID is No"/>
16+
<description value="Check settings Default Value for Disable Automatic Group Changes Based on VAT ID is No"/>
17+
<severity value="MAJOR"/>
18+
<group value="customer"/>
19+
<group value="create"/>
20+
</annotations>
21+
<before>
22+
<magentoCLI command="config:set customer/create_account/viv_disable_auto_group_assign_default 0" stepKey="setConfigDefaultIsNo"/>
23+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
24+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/>
25+
</before>
26+
<after>
27+
<actionGroup ref="logout" stepKey="adminLogout"/>
28+
</after>
29+
30+
<actionGroup ref="AdminNavigateNewCustomerActionGroup" stepKey="navigateToNewCustomer"/>
31+
32+
<actionGroup ref="AdminAssertDefaultValueDisableAutoGroupInCustomerFormActionGroup" stepKey="seeDefaultValueInForm">
33+
<argument name="isChecked" value="0"/>
34+
</actionGroup>
35+
</test>
36+
</tests>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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="AdminCheckDefaultValueDisableAutoGroupChangeIsYesTest">
12+
<annotations>
13+
<features value="Customer"/>
14+
<stories value="Default Value for Disable Automatic Group Changes Based on VAT ID"/>
15+
<title value="Check settings Default Value for Disable Automatic Group Changes Based on VAT ID is Yes"/>
16+
<description value="Check settings Default Value for Disable Automatic Group Changes Based on VAT ID is Yes"/>
17+
<severity value="MAJOR"/>
18+
<group value="customer"/>
19+
<group value="create"/>
20+
</annotations>
21+
<before>
22+
<magentoCLI command="config:set customer/create_account/viv_disable_auto_group_assign_default 1" stepKey="setConfigDefaultIsYes"/>
23+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
24+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/>
25+
</before>
26+
<after>
27+
<magentoCLI command="config:set customer/create_account/viv_disable_auto_group_assign_default 0" stepKey="setConfigDefaultIsNo"/>
28+
<magentoCLI command="cache:flush" stepKey="flushCache"/>
29+
<actionGroup ref="logout" stepKey="adminLogout"/>
30+
</after>
31+
32+
<actionGroup ref="AdminNavigateNewCustomerActionGroup" stepKey="navigateToNewCustomer"/>
33+
34+
<actionGroup ref="AdminAssertDefaultValueDisableAutoGroupInCustomerFormActionGroup" stepKey="seeDefaultValueInForm">
35+
<argument name="isChecked" value="1"/>
36+
</actionGroup>
37+
</test>
38+
</tests>

app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressBelgiumTest.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,13 @@
4747
<actionGroup ref="VerifyCustomerShippingAddressWithState" stepKey="verifyShippingAddress">
4848
<argument name="address" value="updateCustomerBelgiumAddress"/>
4949
</actionGroup>
50+
51+
<!-- Verify country Belgium can be saved without state as state not required -->
52+
<actionGroup ref="StoreFrontClickEditDefaultShippingAddressActionGroup" stepKey="clickOnDefaultShippingAddress"/>
53+
<selectOption selector="{{StorefrontCustomerAddressFormSection.country}}" userInput="Belgium" stepKey="selectCountry"/>
54+
<selectOption selector="{{StorefrontCustomerAddressFormSection.state}}" userInput="Please select a region, state or province." stepKey="selectState"/>
55+
<actionGroup ref="AdminSaveCustomerAddressActionGroup" stepKey="saveAddress"/>
56+
<see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="Belgium" stepKey="seeAssertCustomerDefaultShippingAddressCountry"/>
57+
5058
</test>
5159
</tests>

0 commit comments

Comments
 (0)