Skip to content

Commit 20a62ad

Browse files
merge magento/2.3-develop into magento-epam/EPAM-PR-33
2 parents aad763e + 00042d2 commit 20a62ad

File tree

109 files changed

+1703
-296
lines changed

Some content is hidden

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

109 files changed

+1703
-296
lines changed

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab;
77

8+
use Magento\Customer\Api\Data\GroupInterface;
9+
810
/**
911
* Products mass update inventory tab
1012
*
@@ -29,20 +31,29 @@ class Inventory extends \Magento\Backend\Block\Widget implements \Magento\Backen
2931
*/
3032
protected $disabledFields = [];
3133

34+
/**
35+
* @var \Magento\Framework\Serialize\SerializerInterface
36+
*/
37+
private $serializer;
38+
3239
/**
3340
* @param \Magento\Backend\Block\Template\Context $context
3441
* @param \Magento\CatalogInventory\Model\Source\Backorders $backorders
3542
* @param \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration
3643
* @param array $data
44+
* @param \Magento\Framework\Serialize\SerializerInterface|null $serializer
3745
*/
3846
public function __construct(
3947
\Magento\Backend\Block\Template\Context $context,
4048
\Magento\CatalogInventory\Model\Source\Backorders $backorders,
4149
\Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration,
42-
array $data = []
50+
array $data = [],
51+
\Magento\Framework\Serialize\SerializerInterface $serializer = null
4352
) {
4453
$this->_backorders = $backorders;
4554
$this->stockConfiguration = $stockConfiguration;
55+
$this->serializer = $serializer ?? \Magento\Framework\App\ObjectManager::getInstance()
56+
->get(\Magento\Framework\Serialize\SerializerInterface::class);
4657
parent::__construct($context, $data);
4758
}
4859

@@ -70,11 +81,13 @@ public function getFieldSuffix()
7081
* Retrieve current store id
7182
*
7283
* @return int
84+
* @SuppressWarnings(PHPMD.RequestAwareBlockMethod)
7385
*/
7486
public function getStoreId()
7587
{
76-
$storeId = $this->getRequest()->getParam('store');
77-
return (int) $storeId;
88+
$storeId = (int)$this->getRequest()->getParam('store');
89+
90+
return $storeId;
7891
}
7992

8093
/**
@@ -88,6 +101,22 @@ public function getDefaultConfigValue($field)
88101
return $this->stockConfiguration->getDefaultConfigValue($field);
89102
}
90103

104+
/**
105+
* Returns min_sale_qty configuration for the ALL Customer Group
106+
*
107+
* @return float
108+
*/
109+
public function getDefaultMinSaleQty()
110+
{
111+
$default = $this->stockConfiguration->getDefaultConfigValue('min_sale_qty');
112+
if (!is_numeric($default)) {
113+
$default = $this->serializer->unserialize($default);
114+
$default = $default[GroupInterface::CUST_GROUP_ALL] ?? 1;
115+
}
116+
117+
return (float) $default;
118+
}
119+
91120
/**
92121
* Tab settings
93122
*
@@ -99,6 +128,8 @@ public function getTabLabel()
99128
}
100129

101130
/**
131+
* Return Tab title.
132+
*
102133
* @return \Magento\Framework\Phrase
103134
*/
104135
public function getTabTitle()
@@ -107,22 +138,24 @@ public function getTabTitle()
107138
}
108139

109140
/**
110-
* @return bool
141+
* @inheritdoc
111142
*/
112143
public function canShowTab()
113144
{
114145
return true;
115146
}
116147

117148
/**
118-
* @return bool
149+
* @inheritdoc
119150
*/
120151
public function isHidden()
121152
{
122153
return false;
123154
}
124155

125156
/**
157+
* Get availability status.
158+
*
126159
* @param string $fieldName
127160
* @return bool
128161
* @SuppressWarnings(PHPMD.UnusedFormalParameter)

app/code/Magento/Catalog/Model/Category/Attribute/Source/Layout.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ class Layout extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
1717
*/
1818
protected $pageLayoutBuilder;
1919

20+
/**
21+
* @inheritdoc
22+
* @deprecated since the cache is now handled by \Magento\Theme\Model\PageLayout\Config\Builder::$configFiles
23+
*/
24+
protected $_options = null;
25+
2026
/**
2127
* @param \Magento\Framework\View\Model\PageLayout\Config\BuilderInterface $pageLayoutBuilder
2228
*/
@@ -26,14 +32,14 @@ public function __construct(\Magento\Framework\View\Model\PageLayout\Config\Buil
2632
}
2733

2834
/**
29-
* {@inheritdoc}
35+
* @inheritdoc
3036
*/
3137
public function getAllOptions()
3238
{
33-
if (!$this->_options) {
34-
$this->_options = $this->pageLayoutBuilder->getPageLayoutsConfig()->toOptionArray();
35-
array_unshift($this->_options, ['value' => '', 'label' => __('No layout updates')]);
36-
}
37-
return $this->_options;
39+
$options = $this->pageLayoutBuilder->getPageLayoutsConfig()->toOptionArray();
40+
array_unshift($options, ['value' => '', 'label' => __('No layout updates')]);
41+
$this->_options = $options;
42+
43+
return $options;
3844
}
3945
}

app/code/Magento/Catalog/Model/Product/Attribute/Source/Layout.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ class Layout extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
1717
*/
1818
protected $pageLayoutBuilder;
1919

20+
/**
21+
* @inheritdoc
22+
* @deprecated since the cache is now handled by \Magento\Theme\Model\PageLayout\Config\Builder::$configFiles
23+
*/
24+
protected $_options = null;
25+
2026
/**
2127
* @param \Magento\Framework\View\Model\PageLayout\Config\BuilderInterface $pageLayoutBuilder
2228
*/
@@ -26,14 +32,14 @@ public function __construct(\Magento\Framework\View\Model\PageLayout\Config\Buil
2632
}
2733

2834
/**
29-
* @return array
35+
* @inheritdoc
3036
*/
3137
public function getAllOptions()
3238
{
33-
if (!$this->_options) {
34-
$this->_options = $this->pageLayoutBuilder->getPageLayoutsConfig()->toOptionArray();
35-
array_unshift($this->_options, ['value' => '', 'label' => __('No layout updates')]);
36-
}
37-
return $this->_options;
39+
$options = $this->pageLayoutBuilder->getPageLayoutsConfig()->toOptionArray();
40+
array_unshift($options, ['value' => '', 'label' => __('No layout updates')]);
41+
$this->_options = $options;
42+
43+
return $options;
3844
}
3945
}

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2218,7 +2218,7 @@ private function getTierPriceSelect(array $productIds)
22182218
$this->getLinkField() . ' IN(?)',
22192219
$productIds
22202220
)->order(
2221-
$this->getLinkField()
2221+
'qty'
22222222
);
22232223
return $select;
22242224
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,12 @@
6262
<data key="name" unique="suffix">FifthLevelCategory</data>
6363
<data key="name_lwr" unique="suffix">category</data>
6464
</entity>
65+
<entity name="SimpleRootSubCategory" type="category">
66+
<data key="name" unique="suffix">SimpleRootSubCategory</data>
67+
<data key="name_lwr" unique="suffix">simplerootsubcategory</data>
68+
<data key="is_active">true</data>
69+
<data key="include_in_menu">true</data>
70+
<data key="url_key" unique="suffix">simplerootsubcategory</data>
71+
<var key="parent_id" entityType="category" entityKey="id" />
72+
</entity>
6573
</entities>

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@
481481
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
482482
</entity>
483483
<entity name="defaultSimpleProduct" type="product">
484-
<data key="name" unique="suffix">Test </data>
484+
<data key="name" unique="suffix">Testp</data>
485485
<data key="sku" unique="suffix">testsku</data>
486486
<data key="type_id">simple</data>
487487
<data key="attribute_set_id">4</data>
@@ -497,6 +497,19 @@
497497
<data key="name" unique="suffix">Product With Long Name And Sku - But not too long</data>
498498
<data key="sku" unique="suffix">Product With Long Name And Sku - But not too long</data>
499499
</entity>
500+
<entity name="PaginationProduct" type="product">
501+
<data key="name" unique="suffix">pagi</data>
502+
<data key="sku" unique="suffix">pagisku</data>
503+
<data key="type_id">simple</data>
504+
<data key="attribute_set_id">4</data>
505+
<data key="visibility">4</data>
506+
<data key="price">780.00</data>
507+
<data key="urlKey" unique="suffix">pagiurl-</data>
508+
<data key="status">1</data>
509+
<data key="quantity">50</data>
510+
<data key="weight">5</data>
511+
<requiredEntity type="product_extension_attribute">EavStock100</requiredEntity>
512+
</entity>
500513
<entity name="Magento3" type="image">
501514
<data key="title" unique="suffix">Magento3</data>
502515
<data key="price">1.00</data>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
<element name="rowPosition" type="input" selector="#catalog_category_products_table tbody tr:nth-of-type({{row}}) .col-position .position input" timeout="30" parameterized="true"/>
1717
<element name="productGridNameProduct" type="text" selector="//table[@id='catalog_category_products_table']//td[contains(., '{{productName}}')]" parameterized="true"/>
1818
<element name="productVisibility" type="select" selector="//*[@name='product[visibility]']"/>
19+
<element name="productSelectAll" type="checkbox" selector="input.admin__control-checkbox"/>
1920
</section>
2021
</sections>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@
3131
<element name="newFromDateFilter" type="input" selector="input.admin__control-text[name='news_from_date[from]']"/>
3232
<element name="keywordSearch" type="input" selector="input#fulltext"/>
3333
<element name="keywordSearchButton" type="button" selector=".data-grid-search-control-wrap button.action-submit" timeout="30"/>
34+
<element name="productCount" type="text" selector="#catalog_category_products-total-count"/>
35+
<element name="productPerPage" type="select" selector="#catalog_category_products_page-limit"/>
3436
</section>
3537
</sections>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1010
<section name="AdminProductGridSection">
1111
<element name="productRowBySku" type="block" selector="//div[@id='container']//tr//td[count(../../..//th[./*[.='SKU']]/preceding-sibling::th) + 1][./*[.='{{sku}}']]" parameterized="true" />
12+
<element name="productRowCheckboxBySku" type="block" selector="//div[@id='container']//tr//td[count(../../..//th[./*[.='SKU']]/preceding-sibling::th) + 1][./*[.='{{sku}}']]/../td//input[@data-action='select-row']" parameterized="true" />
1213
<element name="loadingMask" type="text" selector=".admin__data-grid-loading-mask[data-component*='product_listing']"/>
1314
<element name="columnHeader" type="button" selector="//div[@data-role='grid-wrapper']//table[contains(@class, 'data-grid')]/thead/tr/th[contains(@class, 'data-grid-th')]/span[text() = '{{label}}']" parameterized="true" timeout="30"/>
1415
<element name="column" type="text" selector="//tr//td[count(//div[@data-role='grid-wrapper']//tr//th[contains(., '{{column}}')]/preceding-sibling::th) +1 ]" parameterized="true"/>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
10+
<section name="StorefrontCategoryBottomToolbarSection">
11+
<element name="nextPage" type="button" selector=".//*[@class='toolbar toolbar-products'][2]//a[contains(@class, 'next')]" timeout="30"/>
12+
<element name="previousPage" type="button" selector=".//*[@class='toolbar toolbar-products'][2]//a[contains(@class, 'previous')]" timeout="30"/>
13+
<element name="pageNumber" type="text" selector="//*[@class='toolbar toolbar-products'][2]//a[contains(@class, 'page')]//span[2][contains(text() ,'{{var1}}')]" parameterized="true"/>
14+
<element name="perPage" type="select" selector="//*[@class='toolbar toolbar-products'][2]//select[@id='limiter']"/>
15+
</section>
16+
</sections>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminDeleteRootCategoryAssignedToStoreTest">
11+
<annotations>
12+
<stories value="Delete categories"/>
13+
<title value="Cannot delete root category assigned to some store"/>
14+
<description value="Login as admin and root category can not be deleted when category is assigned with any store."/>
15+
<testCaseId value="MC-6050"/>
16+
<severity value="CRITICAL"/>
17+
<group value="Catalog"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/>
22+
<createData entity="NewRootCategory" stepKey="rootCategory" />
23+
</before>
24+
<after>
25+
<actionGroup ref="DeleteCustomStoreActionGroup" stepKey="deleteCreatedStore">
26+
<argument name="storeGroupName" value="customStore.code"/>
27+
</actionGroup>
28+
<deleteData createDataKey="rootCategory" stepKey="deleteRootCategory"/>
29+
<actionGroup ref="logout" stepKey="logout"/>
30+
</after>
31+
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
32+
<waitForPageLoad stepKey="waitForSystemStorePage"/>
33+
<click selector="{{AdminStoresMainActionsSection.createStoreButton}}" stepKey="selectCreateStore"/>
34+
<fillField userInput="{{customStore.name}}" selector="{{AdminNewStoreGroupSection.storeGrpNameTextField}}" stepKey="fillStoreName"/>
35+
<fillField userInput="{{customStore.code}}" selector="{{AdminNewStoreGroupSection.storeGrpCodeTextField}}" stepKey="fillStoreCode"/>
36+
<selectOption userInput="{{NewRootCategory.name}}" selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" stepKey="selectStoreStatus"/>
37+
<click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickSaveStoreButton"/>
38+
<see userInput="You saved the store." stepKey="seeSaveMessage"/>
39+
<!--Verify Delete Root Category can not be deleted-->
40+
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage1"/>
41+
<waitForPageLoad stepKey="waitForCategoryIndexPageToBeLoaded1"/>
42+
<scrollToTopOfPage stepKey="scrollToTopOfPage2"/>
43+
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandToSeeAllCategories"/>
44+
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree(NewRootCategory.name))}}" stepKey="clickRootCategoryInTree"/>
45+
<!--Verify Delete button is not displayed-->
46+
<dontSeeElement selector="{{AdminCategoryMainActionsSection.DeleteButton}}" stepKey="dontSeeDeleteButton"/>
47+
</test>
48+
</tests>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminDeleteRootCategoryTest">
11+
<annotations>
12+
<stories value="Delete categories"/>
13+
<title value="Can delete a root category not assigned to any store"/>
14+
<description value="Login as admin and delete a root category not assigned to any store"/>
15+
<testCaseId value="MC-6048"/>
16+
<severity value="CRITICAL"/>
17+
<group value="Catalog"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/>
22+
<createData entity="NewRootCategory" stepKey="rootCategory" />
23+
</before>
24+
<after>
25+
<actionGroup ref="logout" stepKey="logout"/>
26+
</after>
27+
<!--Verify Created root Category-->
28+
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/>
29+
<waitForPageLoad stepKey="waitForCategoryIndexPageToBeLoaded"/>
30+
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandToSeeAllCategories"/>
31+
<waitForPageLoad stepKey="waitForPageToLoad"/>
32+
<seeElement selector="{{AdminCategoryBasicFieldSection.CategoryNameInput(NewRootCategory.name)}}" stepKey="seeRootCategory"/>
33+
<!--Delete Root Category-->
34+
<deleteData createDataKey="rootCategory" stepKey="deleteRootCategory"/>
35+
<!--Verify Root Category is not listed in backend-->
36+
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage1"/>
37+
<waitForPageLoad stepKey="waitForCategoryIndexPageToBeLoaded1"/>
38+
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandToSeeAllCategories1"/>
39+
<dontSee selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{NewRootCategory.name}}" stepKey="dontSeeRootCategory"/>
40+
</test>
41+
</tests>

0 commit comments

Comments
 (0)