Skip to content

Commit 23bd4d6

Browse files
Merge pull request magento#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>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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\Customer\Ui\Component\Form\Field;
9+
10+
use Magento\Framework\View\Element\UiComponent\ContextInterface;
11+
use Magento\Framework\View\Element\UiComponentFactory;
12+
use Magento\Framework\View\Element\UiComponentInterface;
13+
use Magento\Customer\Helper\Address as AddressHelper;
14+
15+
/**
16+
* Process setting to set Default Value for Disable Automatic Group Changes Based on VAT ID
17+
*
18+
* Class \Magento\Customer\Ui\Component\Form\Field\DisableAutoGroupChange
19+
*/
20+
class DisableAutoGroupChange extends \Magento\Ui\Component\Form\Field
21+
{
22+
/**
23+
* Yes value for Default Value for Disable Automatic Group Changes Based on VAT ID
24+
*/
25+
const DISABLE_AUTO_GROUP_CHANGE_YES = '1';
26+
27+
/**
28+
* Address Helper
29+
*
30+
* @var AddressHelper
31+
*/
32+
private $addressHelper;
33+
34+
/**
35+
* Constructor
36+
*
37+
* @param ContextInterface $context
38+
* @param UiComponentFactory $uiComponentFactory
39+
* @param AddressHelper $addressHelper
40+
* @param UiComponentInterface[] $components
41+
* @param array $data
42+
*/
43+
public function __construct(
44+
ContextInterface $context,
45+
UiComponentFactory $uiComponentFactory,
46+
AddressHelper $addressHelper,
47+
array $components = [],
48+
array $data = []
49+
) {
50+
$this->addressHelper = $addressHelper;
51+
parent::__construct($context, $uiComponentFactory, $components, $data);
52+
}
53+
54+
/**
55+
* Prepare component configuration
56+
*
57+
* @return void
58+
* @throws \Magento\Framework\Exception\LocalizedException
59+
*/
60+
public function prepare()
61+
{
62+
parent::prepare();
63+
64+
if ($this->addressHelper->isDisableAutoGroupAssignDefaultValue()) {
65+
$currentConfig = $this->getData('config');
66+
$currentConfig['default'] = self::DISABLE_AUTO_GROUP_CHANGE_YES;
67+
$this->setData('config', $currentConfig);
68+
}
69+
}
70+
}

app/code/Magento/Customer/view/base/ui_component/customer_form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
<dataType>number</dataType>
170170
</settings>
171171
</field>
172-
<field name="disable_auto_group_change" formElement="checkbox">
172+
<field name="disable_auto_group_change" formElement="checkbox" class="Magento\Customer\Ui\Component\Form\Field\DisableAutoGroupChange">
173173
<argument name="data" xsi:type="array">
174174
<item name="config" xsi:type="array">
175175
<item name="fieldGroup" xsi:type="string">group_id</item>

app/code/Magento/Directory/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<item name="DE" xsi:type="string">DE</item>
3636
<item name="AT" xsi:type="string">AT</item>
3737
<item name="FI" xsi:type="string">FI</item>
38+
<item name="BE" xsi:type="string">BE</item>
3839
</argument>
3940
</arguments>
4041
</type>

app/code/Magento/Review/Block/Adminhtml/Rating/Edit/Tab/Form.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,16 @@ protected function addRatingFieldset()
111111
]
112112
);
113113

114-
foreach ($this->systemStore->getStoreCollection() as $store) {
115-
$this->getFieldset('rating_form')->addField(
116-
'rating_code_' . $store->getId(),
117-
'text',
118-
['label' => $store->getName(), 'name' => 'rating_codes[' . $store->getId() . ']']
119-
);
114+
if (!$this->_storeManager->isSingleStoreMode()) {
115+
foreach ($this->systemStore->getStoreCollection() as $store) {
116+
$this->getFieldset('rating_form')->addField(
117+
'rating_code_' . $store->getId(),
118+
'text',
119+
['label' => $store->getName(), 'name' => 'rating_codes[' . $store->getId() . ']']
120+
);
121+
}
120122
}
123+
121124
$this->setRatingData();
122125
}
123126

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminAssertStoreViewRatingTitleWhenSingleStoreModeIsNoActionGroup">
11+
<annotations>
12+
<description>If Single Store Mode is disabled, default store view title label should be displayed.</description>
13+
</annotations>
14+
<seeElement selector="{{AdminEditAndNewRatingSection.defaultStoreViewTitleLabel}}" stepKey="seeLabel"/>
15+
<seeElement selector="{{AdminEditAndNewRatingSection.defaultStoreViewTitleInput}}" stepKey="seeInput"/>
16+
</actionGroup>
17+
</actionGroups>

0 commit comments

Comments
 (0)