Skip to content

Commit 0dbfabf

Browse files
MarianaMariana
authored andcommitted
Merge branch '2.3-develop' of github.com:magento/magento2ce into mpi-forwardport-1010
2 parents 94ad139 + f710f9b commit 0dbfabf

File tree

70 files changed

+867
-226
lines changed

Some content is hidden

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

70 files changed

+867
-226
lines changed

app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Search\Model\QueryInterface;
1111
use Magento\AdvancedSearch\Model\SuggestedQueriesInterface;
1212

13+
/**
14+
* Class DataProvider
15+
*/
1316
class DataProvider implements SuggestedQueriesInterface
1417
{
1518
/**
@@ -51,6 +54,8 @@ class DataProvider implements SuggestedQueriesInterface
5154
private $recommendationsFactory;
5255

5356
/**
57+
* DataProvider constructor.
58+
*
5459
* @param ScopeConfigInterface $scopeConfig
5560
* @param \Magento\Catalog\Model\Layer\Resolver $layerResolver
5661
* @param \Magento\AdvancedSearch\Model\ResourceModel\RecommendationsFactory $recommendationsFactory
@@ -69,18 +74,20 @@ public function __construct(
6974
}
7075

7176
/**
77+
* Is Results Count Enabled
78+
*
7279
* @return bool
7380
*/
7481
public function isResultsCountEnabled()
7582
{
76-
return (bool)$this->scopeConfig->getValue(
83+
return $this->scopeConfig->isSetFlag(
7784
self::CONFIG_RESULTS_COUNT_ENABLED,
7885
ScopeInterface::SCOPE_STORE
7986
);
8087
}
8188

8289
/**
83-
* {@inheritdoc}
90+
* @inheritdoc
8491
*/
8592
public function getItems(QueryInterface $query)
8693
{
@@ -102,6 +109,8 @@ public function getItems(QueryInterface $query)
102109
}
103110

104111
/**
112+
* Return Search Recommendations
113+
*
105114
* @param QueryInterface $query
106115
* @return array
107116
*/
@@ -126,17 +135,21 @@ private function getSearchRecommendations(\Magento\Search\Model\QueryInterface $
126135
}
127136

128137
/**
138+
* Is Search Recommendations Enabled
139+
*
129140
* @return bool
130141
*/
131142
private function isSearchRecommendationsEnabled()
132143
{
133-
return (bool)$this->scopeConfig->getValue(
144+
return $this->scopeConfig->isSetFlag(
134145
self::CONFIG_IS_ENABLED,
135146
ScopeInterface::SCOPE_STORE
136147
);
137148
}
138149

139150
/**
151+
* Return Search Recommendations Count
152+
*
140153
* @return int
141154
*/
142155
private function getSearchRecommendationsCount()

app/code/Magento/Catalog/Model/ImageUploader.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,9 @@ class ImageUploader
6767
/**
6868
* List of allowed image mime types
6969
*
70-
* @var array
70+
* @var string[]
7171
*/
72-
private $allowedMimeTypes = [
73-
'image/jpg',
74-
'image/jpeg',
75-
'image/gif',
76-
'image/png',
77-
];
72+
private $allowedMimeTypes;
7873

7974
/**
8075
* ImageUploader constructor
@@ -87,6 +82,7 @@ class ImageUploader
8782
* @param string $baseTmpPath
8883
* @param string $basePath
8984
* @param string[] $allowedExtensions
85+
* @param string[] $allowedMimeTypes
9086
*/
9187
public function __construct(
9288
\Magento\MediaStorage\Helper\File\Storage\Database $coreFileStorageDatabase,
@@ -96,7 +92,8 @@ public function __construct(
9692
\Psr\Log\LoggerInterface $logger,
9793
$baseTmpPath,
9894
$basePath,
99-
$allowedExtensions
95+
$allowedExtensions,
96+
$allowedMimeTypes = []
10097
) {
10198
$this->coreFileStorageDatabase = $coreFileStorageDatabase;
10299
$this->mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA);
@@ -106,6 +103,7 @@ public function __construct(
106103
$this->baseTmpPath = $baseTmpPath;
107104
$this->basePath = $basePath;
108105
$this->allowedExtensions = $allowedExtensions;
106+
$this->allowedMimeTypes = $allowedMimeTypes;
109107
}
110108

111109
/**
@@ -165,7 +163,7 @@ public function getBasePath()
165163
}
166164

167165
/**
168-
* Retrieve base path
166+
* Retrieve allowed extensions
169167
*
170168
* @return string[]
171169
*/

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ public function getPrice()
596596
* @see \Magento\Catalog\Model\Product\Visibility
597597
*
598598
* @return int
599+
* @codeCoverageIgnoreStart
599600
*/
600601
public function getVisibility()
601602
{
@@ -818,6 +819,9 @@ public function getStoreIds()
818819
if (!$this->hasStoreIds()) {
819820
$storeIds = [];
820821
if ($websiteIds = $this->getWebsiteIds()) {
822+
if ($this->_storeManager->isSingleStoreMode()) {
823+
$websiteIds = array_keys($websiteIds);
824+
}
821825
foreach ($websiteIds as $websiteId) {
822826
$websiteStores = $this->_storeManager->getWebsite($websiteId)->getStoreIds();
823827
$storeIds = array_merge($storeIds, $websiteStores);
@@ -1049,7 +1053,8 @@ public function reindex()
10491053
*
10501054
* Register indexing event before delete product
10511055
*
1052-
* @return \Magento\Catalog\Model\Product
1056+
* @return $this
1057+
* @throws \Magento\Framework\Exception\LocalizedException
10531058
*/
10541059
public function beforeDelete()
10551060
{
@@ -1723,8 +1728,6 @@ public function getIsSalable()
17231728
/**
17241729
* Check is a virtual product
17251730
*
1726-
* Data helper wrapper
1727-
*
17281731
* @return bool
17291732
*/
17301733
public function isVirtual()
@@ -2033,7 +2036,7 @@ public function getIsVirtual()
20332036
*
20342037
* @param string $code Option code
20352038
* @param mixed $value Value of the option
2036-
* @param int|Product $product Product ID
2039+
* @param int|Product|null $product Product ID
20372040
* @return $this
20382041
*/
20392042
public function addCustomOption($code, $value, $product = null)
@@ -2227,9 +2230,9 @@ public function getPreconfiguredValues()
22272230
}
22282231

22292232
/**
2230-
* Prepare product custom options.
2233+
* Prepare product custom options
22312234
*
2232-
* To be sure that all product custom options does not has ID and has product instance
2235+
* To be sure that all product custom options does not has ID and has product instance.
22332236
*
22342237
* @return \Magento\Catalog\Model\Product
22352238
*/
@@ -2586,10 +2589,11 @@ public function setExtensionAttributes(\Magento\Catalog\Api\Data\ProductExtensio
25862589
//@codeCoverageIgnoreEnd
25872590

25882591
/**
2589-
* Convert array to media gallery interface
2592+
* Convert Image to ProductAttributeMediaGalleryEntryInterface
25902593
*
25912594
* @param array $mediaGallery
25922595
* @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]
2596+
* @throws \Magento\Framework\Exception\LocalizedException
25932597
*/
25942598
protected function convertToMediaGalleryInterface(array $mediaGallery)
25952599
{
@@ -2608,6 +2612,7 @@ protected function convertToMediaGalleryInterface(array $mediaGallery)
26082612
* Returns media gallery entries
26092613
*
26102614
* @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]|null
2615+
* @throws \Magento\Framework\Exception\LocalizedException
26112616
*/
26122617
public function getMediaGalleryEntries()
26132618
{
@@ -2625,6 +2630,7 @@ public function getMediaGalleryEntries()
26252630
*
26262631
* @param ProductAttributeMediaGalleryEntryInterface[] $mediaGalleryEntries
26272632
* @return $this
2633+
* @throws \Magento\Framework\Exception\LocalizedException
26282634
*/
26292635
public function setMediaGalleryEntries(array $mediaGalleryEntries = null)
26302636
{

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,10 @@
257257
<arguments>
258258
<argument name="website" type="string"/>
259259
</arguments>
260-
<scrollTo selector="{{CreateProductSection.productInWebsite}}" stepKey="ScrollToWebsites"/>
261-
<click selector="{{CreateProductSection.productInWebsite}}" stepKey="ClickTpOpenProductInWebsite"/>
260+
<scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToWebsites"/>
261+
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="clickToOpenProductInWebsite"/>
262262
<waitForPageLoad stepKey="waitForPageOpened"/>
263-
<click selector="{{CreateProductSection.isSelected(website)}}" stepKey="SelectWebsite"/>
264-
<click selector="{{CreateProductSection.saveButton}}" stepKey="clickSaveProduct"/>
263+
<checkOption selector="{{ProductInWebsitesSection.website(website)}}" stepKey="selectWebsite"/>
265264
</actionGroup>
266265

267266
<!--Switch to New Store view-->

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,26 @@
2020
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/>
2121
<waitForPageLoad stepKey="waitForPageLoad2" />
2222
</actionGroup>
23+
<actionGroup name="navigateToEditProductAttribute">
24+
<arguments>
25+
<argument name="ProductAttribute" type="string"/>
26+
</arguments>
27+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
28+
<waitForPageLoad stepKey="waitForPageLoad1"/>
29+
<fillField selector="{{AdminProductAttributeGridSection.GridFilterFrontEndLabel}}" userInput="{{ProductAttribute}}" stepKey="navigateToAttributeEditPage1" />
30+
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="navigateToAttributeEditPage2" />
31+
<waitForPageLoad stepKey="waitForPageLoad2" />
32+
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="navigateToAttributeEditPage3" />
33+
<waitForPageLoad stepKey="waitForPageLoad3" />
34+
</actionGroup>
35+
<actionGroup name="changeUseForPromoRuleConditionsProductAttribute">
36+
<arguments>
37+
<argument name="option" type="string"/>
38+
</arguments>
39+
<click selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" stepKey="clickStoreFrontPropertiesTab"/>
40+
<waitForPageLoad stepKey="waitForPageLoad"/>
41+
<selectOption selector="{{StorefrontPropertiesSection.useForPromoRuleConditions}}" userInput="{{option}}" stepKey="changeOption"/>
42+
<click selector="{{AttributePropertiesSection.Save}}" stepKey="saveAttribute"/>
43+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the product attribute." stepKey="successMessage"/>
44+
</actionGroup>
2345
</actionGroups>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
<argument name="mode" type="string"/>
1616
<argument name="numOfProductsPerPage" type="string"/>
1717
<argument name="sortBy" type="string" defaultValue="position"/>
18+
<argument name="sort" type="string" defaultValue="asc"/>
1819
</arguments>
1920
<!-- Go to storefront category page -->
20-
<amOnPage url="{{StorefrontCategoryPage.url(category)}}?product_list_limit={{numOfProductsPerPage}}&amp;product_list_mode={{mode}}&amp;product_list_order={{sortBy}}" stepKey="onCategoryPage"/>
21+
<amOnPage url="{{StorefrontCategoryPage.url(category)}}?product_list_limit={{numOfProductsPerPage}}&amp;product_list_mode={{mode}}&amp;product_list_order={{sortBy}}&amp;product_list_dir={{sort}}" stepKey="onCategoryPage"/>
2122
<waitForPageLoad stepKey="waitForPageLoad"/>
2223
</actionGroup>
2324

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@
1616
<data key="store_id">0</data>
1717
<data key="label" unique="suffix">attributeTwo</data>
1818
</entity>
19+
<entity name="ProductAttributeFrontendLabelThree" type="FrontendLabel">
20+
<data key="store_id">0</data>
21+
<data key="label" unique="suffix">attributeThree</data>
22+
</entity>
1923
</entities>

app/code/Magento/Catalog/Test/Mftf/Page/StorefrontProductPage.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11-
<page name="StorefrontProductPage" url="/{{var1}}.html" area="storefront" module="Catalog" parameterized="true">
11+
<page name="StorefrontProductPage" url="/{{var1}}.html" area="storefront" module="Magento_Catalog" parameterized="true">
1212
<section name="StorefrontProductInfoMainSection" />
1313
<section name="StorefrontProductInfoDetailsSection" />
1414
<section name="WYSIWYGToolbarSection"/>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
<element name="rowProductSku" type="text" selector="#catalog_category_products_table tbody tr:nth-of-type({{row}}) .col-sku" parameterized="true"/>
1515
<element name="rowPrice" type="text" selector="#catalog_category_products_table tbody tr:nth-of-type({{row}}) .col-price" parameterized="true"/>
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"/>
17+
<element name="productGridNameProduct" type="text" selector="//table[@id='catalog_category_products_table']//td[contains(., '{{productName}}')]" parameterized="true"/>
1718
</section>
18-
</sections>
19+
</sections>

0 commit comments

Comments
 (0)