Skip to content

Commit 4dff057

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into 2.3-develop-mftf-pr23
2 parents 94aa75b + 9cc293e commit 4dff057

File tree

85 files changed

+1671
-237
lines changed

Some content is hidden

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

85 files changed

+1671
-237
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/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@ public function execute()
8989
['fileId' => 'image']
9090
);
9191
$uploader->setAllowedExtensions($this->getAllowedExtensions());
92-
93-
if (!$uploader->checkMimeType($this->getAllowedMimeTypes())) {
94-
throw new LocalizedException(__('Disallowed File Type.'));
95-
}
96-
9792
$imageAdapter = $this->adapterFactory->create();
9893
$uploader->addValidateCallback('catalog_product_image', $imageAdapter, 'validateUploadFile');
9994
$uploader->setAllowRenameFiles(true);
@@ -133,14 +128,4 @@ private function getAllowedExtensions()
133128
{
134129
return array_keys($this->allowedMimeTypes);
135130
}
136-
137-
/**
138-
* Get the set of allowed mime types.
139-
*
140-
* @return array
141-
*/
142-
private function getAllowedMimeTypes()
143-
{
144-
return array_values($this->allowedMimeTypes);
145-
}
146131
}

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminClickOnAdvancedInventoryLinkActionGroup.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,15 @@
1818
<click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink"/>
1919
<waitForPageLoad stepKey="waitForAdvancedInventoryPageToLoad"/>
2020
</actionGroup>
21+
22+
<!-- ActionGroup click on Advanced Inventory Button in product form;
23+
You must already be on the product form page -->
24+
<actionGroup name="AdminClickOnAdvancedInventoryButtonActionGroup">
25+
<annotations>
26+
<description>Clicks on the 'Advanced Inventory' link on the Admin Product creation/edit page.</description>
27+
</annotations>
28+
29+
<click selector="{{AdminProductFormSection.advancedInventoryButton}}" stepKey="clickOnAdvancedInventoryLink"/>
30+
<waitForPageLoad stepKey="waitForAdvancedInventoryPageToLoad"/>
31+
</actionGroup>
2132
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeOptionData.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@
8686
<data key="label" unique="suffix">White</data>
8787
<data key="value" unique="suffix">white</data>
8888
</entity>
89+
<entity name="ProductAttributeOption9" type="ProductAttributeOption">
90+
<var key="attribute_code" entityKey="attribute_code" entityType="ProductAttribute"/>
91+
<data key="label" unique="suffix">Blue</data>
92+
<data key="is_default">false</data>
93+
<data key="sort_order">3</data>
94+
<requiredEntity type="StoreLabel">Option11Store0</requiredEntity>
95+
<requiredEntity type="StoreLabel">Option11Store1</requiredEntity>
96+
</entity>
8997
<!-- Product attribute options from file "export_import_configurable_product.csv" -->
9098
<entity name="ProductAttributeOptionOneForExportImport" extends="productAttributeOption1" type="ProductAttributeOption">
9199
<data key="label">option1</data>

app/code/Magento/Catalog/Test/Mftf/Data/StoreLabelData.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,12 @@
7272
<data key="store_id">1</data>
7373
<data key="label">Red</data>
7474
</entity>
75+
<entity name="Option11Store0" type="StoreLabel">
76+
<data key="store_id">0</data>
77+
<data key="label">Blue</data>
78+
</entity>
79+
<entity name="Option11Store1" type="StoreLabel">
80+
<data key="store_id">1</data>
81+
<data key="label">Blue</data>
82+
</entity>
7583
</entities>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<element name="categoriesDropdown" type="multiselect" selector="div[data-index='category_ids']" timeout="30"/>
3939
<element name="unselectCategories" type="button" selector="//span[@class='admin__action-multiselect-crumb']/span[contains(.,'{{category}}')]/../button[@data-action='remove-selected-item']" parameterized="true" timeout="30"/>
4040
<element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/>
41-
<element name="advancedInventoryLink" type="button" selector="//button[contains(@data-index, 'advanced_inventory_button')]" timeout="30"/>
41+
<element name="advancedInventoryLink" type="button" selector="button[data-index='advanced_inventory_button'].action-additional" timeout="30"/>
4242
<element name="productStockStatus" type="select" selector="select[name='product[quantity_and_stock_status][is_in_stock]']" timeout="30"/>
4343
<element name="productStockStatusDisabled" type="select" selector="select[name='product[quantity_and_stock_status][is_in_stock]'][disabled=true]"/>
4444
<element name="stockStatus" type="select" selector="[data-index='product-details'] select[name='product[quantity_and_stock_status][is_in_stock]']"/>
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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="AdminProductGridFilteringByCustomAttributeTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Product grid"/>
15+
<title value="Sorting the product grid by custom product attribute"/>
16+
<description value="Sorting the product grid by custom product attribute should sort Alphabetically instead of value id"/>
17+
<severity value="MAJOR"/>
18+
<useCaseId value="MC-19031"/>
19+
<testCaseId value="MC-20329"/>
20+
<group value="catalog"/>
21+
</annotations>
22+
<before>
23+
<!--Login as admin and delete all products -->
24+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
25+
<actionGroup ref="deleteAllProductsUsingProductGrid" stepKey="deleteAllProducts"/>
26+
<!--Create dropdown product attribute-->
27+
<createData entity="productDropDownAttribute" stepKey="createDropdownAttribute"/>
28+
<!--Create attribute options-->
29+
<createData entity="ProductAttributeOption7" stepKey="createFirstProductAttributeOption">
30+
<requiredEntity createDataKey="createDropdownAttribute"/>
31+
</createData>
32+
<createData entity="ProductAttributeOption8" stepKey="createSecondProductAttributeOption">
33+
<requiredEntity createDataKey="createDropdownAttribute"/>
34+
</createData>
35+
<createData entity="ProductAttributeOption9" stepKey="createThirdProductAttributeOption">
36+
<requiredEntity createDataKey="createDropdownAttribute"/>
37+
</createData>
38+
<!--Add attribute to default attribute set-->
39+
<createData entity="AddToDefaultSet" stepKey="addAttributeToDefaultSet">
40+
<requiredEntity createDataKey="createDropdownAttribute"/>
41+
</createData>
42+
<!--Create category-->
43+
<createData entity="_defaultCategory" stepKey="createCategory"/>
44+
<!--Create 3 products-->
45+
<createData entity="ApiSimpleProduct" stepKey="createFirstProduct">
46+
<requiredEntity createDataKey="createCategory"/>
47+
</createData>
48+
<createData entity="ApiSimpleProduct" stepKey="createSecondProduct">
49+
<requiredEntity createDataKey="createCategory"/>
50+
</createData>
51+
<createData entity="ApiSimpleProduct" stepKey="createThirdProduct">
52+
<requiredEntity createDataKey="createCategory"/>
53+
</createData>
54+
<!--Update first product-->
55+
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForFirstProduct">
56+
<argument name="product" value="$$createFirstProduct$$"/>
57+
</actionGroup>
58+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="editFirstProduct">
59+
<argument name="product" value="$$createFirstProduct$$"/>
60+
</actionGroup>
61+
<selectOption selector="{{AdminProductFormSection.customSelectField($$createDropdownAttribute.attribute[attribute_code]$$)}}" userInput="$$createFirstProductAttributeOption.option[store_labels][0][label]$$" stepKey="setFirstAttributeValue"/>
62+
<actionGroup ref="saveProductForm" stepKey="saveFirstProduct"/>
63+
<!--Update second product-->
64+
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSecondProduct">
65+
<argument name="product" value="$$createSecondProduct$$"/>
66+
</actionGroup>
67+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="editSecondProduct">
68+
<argument name="product" value="$$createSecondProduct$$"/>
69+
</actionGroup>
70+
<selectOption selector="{{AdminProductFormSection.customSelectField($$createDropdownAttribute.attribute[attribute_code]$$)}}" userInput="$$createSecondProductAttributeOption.option[store_labels][0][label]$$" stepKey="setSecondAttributeValue"/>
71+
<actionGroup ref="saveProductForm" stepKey="saveSecondProduct"/>
72+
<!--Update third product-->
73+
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForThirdProduct">
74+
<argument name="product" value="$$createThirdProduct$$"/>
75+
</actionGroup>
76+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="editThirdProduct">
77+
<argument name="product" value="$$createThirdProduct$$"/>
78+
</actionGroup>
79+
<selectOption selector="{{AdminProductFormSection.customSelectField($$createDropdownAttribute.attribute[attribute_code]$$)}}" userInput="$$createThirdProductAttributeOption.option[store_labels][0][label]$$" stepKey="setThirdAttributeValue"/>
80+
<actionGroup ref="saveProductForm" stepKey="saveThirdProduct"/>
81+
</before>
82+
<after>
83+
<!--Delete products-->
84+
<deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/>
85+
<deleteData createDataKey="createSecondProduct" stepKey="deleteSecondProduct"/>
86+
<deleteData createDataKey="createThirdProduct" stepKey="deleteThirdProduct"/>
87+
<!--Delete attribute-->
88+
<deleteData createDataKey="createDropdownAttribute" stepKey="deleteDropdownAttribute"/>
89+
<!--Delete category-->
90+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
91+
<actionGroup ref="NavigateToAndResetProductGridToDefaultView" stepKey="NavigateToAndResetProductGridToDefaultViewAfterTest"/>
92+
<actionGroup ref="logout" stepKey="logout"/>
93+
</after>
94+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
95+
<waitForPageLoad stepKey="waitForProductGridPageLoad"/>
96+
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductGridFilters"/>
97+
<!--Sort by custom attribute DESC using grabbed value-->
98+
<conditionalClick selector="{{AdminProductGridSection.columnHeader($$createDropdownAttribute.attribute[frontend_labels][0][label]$$)}}" dependentSelector="{{AdminProductGridSection.columnHeader($$createDropdownAttribute.attribute[frontend_labels][0][label]$$)}}" visible="true" stepKey="ascendSortByCustomAttribute"/>
99+
<waitForPageLoad stepKey="waitForProductGridLoad"/>
100+
<!--Check products sorting. Expected result => Blue-Green-Red -->
101+
<see selector="{{AdminProductGridSection.productGridNameProduct($$createSecondProduct.name$$)}}" userInput="$$createSecondProduct.name$$" stepKey="seeSecondProductName"/>
102+
<see selector="{{AdminProductGridSection.productGridNameProduct($$createFirstProduct.name$$)}}" userInput="$$createFirstProduct.name$$" stepKey="seeFirstProductName"/>
103+
<see selector="{{AdminProductGridSection.productGridNameProduct($$createThirdProduct.name$$)}}" userInput="$$createThirdProduct.name$$" stepKey="seeThirdProductName"/>
104+
</test>
105+
</tests>

app/code/Magento/Catalog/Test/Mftf/Test/VerifyCategoryProductAndProductCategoryPartialReindexTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
</actionGroup>
5757

5858
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
59+
<magentoCLI command="cache:flush" arguments="full_page" stepKey="flushCache"/>
5960
</before>
6061
<after>
6162
<!-- Change "Category Products" and "Product Categories" indexers to "Update on Save" mode -->

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ public function modifyMeta(array $meta)
149149

150150
$this->specialPriceDataToInline();
151151
$this->customizeTierPrice();
152+
$this->customizePrice();
152153

153154
if (isset($this->meta['advanced-pricing'])) {
154155
$this->addAdvancedPriceLink();
@@ -197,6 +198,29 @@ protected function preparePriceFields($fieldCode)
197198
return $this;
198199
}
199200

201+
/**
202+
* Customize price field.
203+
*
204+
* @return $this
205+
*/
206+
private function customizePrice(): AdvancedPricing
207+
{
208+
$pathFrom = $this->arrayManager->findPath('price', $this->meta, null, 'children');
209+
210+
if ($pathFrom) {
211+
$this->meta = $this->arrayManager->merge(
212+
$this->arrayManager->slicePath($pathFrom, 0, -2) . '/arguments/data/config',
213+
$this->meta,
214+
[
215+
'label' => false,
216+
'required' => false,
217+
]
218+
);
219+
}
220+
221+
return $this;
222+
}
223+
200224
/**
201225
* Customize tier price field
202226
*
@@ -573,21 +597,21 @@ private function specialPriceDataToInline()
573597
$this->arrayManager->slicePath($pathFrom, 0, -2) . '/arguments/data/config',
574598
$this->meta,
575599
[
576-
'label' => __('Special Price From'),
600+
'label' => false,
601+
'required' => false,
577602
'additionalClasses' => 'admin__control-grouped-date',
578603
'breakLine' => false,
579604
'component' => 'Magento_Ui/js/form/components/group',
580-
'scopeLabel' =>
581-
$this->arrayManager->get($pathFrom . '/arguments/data/config/scopeLabel', $this->meta),
582605
]
583606
);
584607
$this->meta = $this->arrayManager->merge(
585608
$pathFrom . '/arguments/data/config',
586609
$this->meta,
587610
[
588611
'label' => __('Special Price From'),
589-
'scopeLabel' => null,
590-
'additionalClasses' => 'admin__field-date'
612+
'scopeLabel' =>
613+
$this->arrayManager->get($pathFrom . '/arguments/data/config/scopeLabel', $this->meta),
614+
'additionalClasses' => 'admin__field-date',
591615
]
592616
);
593617
$this->meta = $this->arrayManager->merge(

0 commit comments

Comments
 (0)