Skip to content

Commit 556aef3

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-96389
2 parents eb8fdfe + 069d5cd commit 556aef3

File tree

85 files changed

+2978
-349
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

+2978
-349
lines changed

app/code/Magento/Backend/Model/AdminPathConfig.php

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,39 +48,37 @@ public function __construct(
4848
}
4949

5050
/**
51-
* {@inheritdoc}
52-
*
53-
* @param \Magento\Framework\App\RequestInterface $request
54-
* @return string
51+
* @inheritdoc
5552
*/
5653
public function getCurrentSecureUrl(\Magento\Framework\App\RequestInterface $request)
5754
{
5855
return $this->url->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/');
5956
}
6057

6158
/**
62-
* {@inheritdoc}
63-
*
64-
* @param string $path
65-
* @return bool
59+
* @inheritdoc
6660
*/
6761
public function shouldBeSecure($path)
6862
{
69-
return parse_url(
70-
(string)$this->coreConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, 'default'),
71-
PHP_URL_SCHEME
72-
) === 'https'
73-
|| $this->backendConfig->isSetFlag(Store::XML_PATH_SECURE_IN_ADMINHTML)
74-
&& parse_url(
75-
(string)$this->coreConfig->getValue(Store::XML_PATH_SECURE_BASE_URL, 'default'),
76-
PHP_URL_SCHEME
77-
) === 'https';
63+
$baseUrl = (string)$this->coreConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, 'default');
64+
if (parse_url($baseUrl, PHP_URL_SCHEME) === 'https') {
65+
return true;
66+
}
67+
68+
if ($this->backendConfig->isSetFlag(Store::XML_PATH_SECURE_IN_ADMINHTML)) {
69+
if ($this->backendConfig->isSetFlag('admin/url/use_custom')) {
70+
$adminBaseUrl = (string)$this->coreConfig->getValue('admin/url/custom', 'default');
71+
} else {
72+
$adminBaseUrl = (string)$this->coreConfig->getValue(Store::XML_PATH_SECURE_BASE_URL, 'default');
73+
}
74+
return parse_url($adminBaseUrl, PHP_URL_SCHEME) === 'https';
75+
}
76+
77+
return false;
7878
}
7979

8080
/**
81-
* {@inheritdoc}
82-
*
83-
* @return string
81+
* @inheritdoc
8482
*/
8583
public function getDefaultPath()
8684
{

app/code/Magento/Backend/Test/Unit/Model/AdminPathConfigTest.php

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,35 @@ public function testGetCurrentSecureUrl()
7676
* @param $unsecureBaseUrl
7777
* @param $useSecureInAdmin
7878
* @param $secureBaseUrl
79+
* @param $useCustomUrl
80+
* @param $customUrl
7981
* @param $expected
8082
* @dataProvider shouldBeSecureDataProvider
8183
*/
82-
public function testShouldBeSecure($unsecureBaseUrl, $useSecureInAdmin, $secureBaseUrl, $expected)
83-
{
84-
$coreConfigValueMap = [
84+
public function testShouldBeSecure(
85+
$unsecureBaseUrl,
86+
$useSecureInAdmin,
87+
$secureBaseUrl,
88+
$useCustomUrl,
89+
$customUrl,
90+
$expected
91+
) {
92+
$coreConfigValueMap = $this->returnValueMap([
8593
[\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, 'default', null, $unsecureBaseUrl],
8694
[\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, 'default', null, $secureBaseUrl],
87-
];
88-
$this->coreConfig->expects($this->any())->method('getValue')->will($this->returnValueMap($coreConfigValueMap));
89-
$this->backendConfig->expects($this->any())->method('isSetFlag')->willReturn($useSecureInAdmin);
95+
['admin/url/custom', 'default', null, $customUrl],
96+
]);
97+
$backendConfigFlagsMap = $this->returnValueMap([
98+
[\Magento\Store\Model\Store::XML_PATH_SECURE_IN_ADMINHTML, $useSecureInAdmin],
99+
['admin/url/use_custom', $useCustomUrl],
100+
]);
101+
$this->coreConfig->expects($this->atLeast(1))->method('getValue')
102+
->will($coreConfigValueMap);
103+
$this->coreConfig->expects($this->atMost(2))->method('getValue')
104+
->will($coreConfigValueMap);
105+
106+
$this->backendConfig->expects($this->atMost(2))->method('isSetFlag')
107+
->will($backendConfigFlagsMap);
90108
$this->assertEquals($expected, $this->adminPathConfig->shouldBeSecure(''));
91109
}
92110

@@ -96,13 +114,13 @@ public function testShouldBeSecure($unsecureBaseUrl, $useSecureInAdmin, $secureB
96114
public function shouldBeSecureDataProvider()
97115
{
98116
return [
99-
['http://localhost/', false, 'default', false],
100-
['http://localhost/', true, 'default', false],
101-
['https://localhost/', false, 'default', true],
102-
['https://localhost/', true, 'default', true],
103-
['http://localhost/', false, 'https://localhost/', false],
104-
['http://localhost/', true, 'https://localhost/', true],
105-
['https://localhost/', true, 'https://localhost/', true],
117+
['http://localhost/', false, 'default', false, '', false],
118+
['http://localhost/', true, 'default', false, '', false],
119+
['https://localhost/', false, 'default', false, '', true],
120+
['https://localhost/', true, 'default', false, '', true],
121+
['http://localhost/', false, 'https://localhost/', false, '', false],
122+
['http://localhost/', true, 'https://localhost/', false, '', true],
123+
['https://localhost/', true, 'https://localhost/', false, '', true],
106124
];
107125
}
108126

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,30 @@
237237
</arguments>
238238
<amOnPage url="{{AdminCategoryPage.page}}" stepKey="amOnCategoryPage"/>
239239
<waitForPageLoad stepKey="waitForPageLoad1"/>
240-
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree(Category.Name)}}" stepKey="navigateToCreatedCategory" />
240+
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandAll"/>
241241
<waitForPageLoad stepKey="waitForPageLoad2"/>
242+
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree(Category.Name)}}" stepKey="navigateToCreatedCategory" />
242243
<waitForLoadingMaskToDisappear stepKey="waitForSpinner" />
243244
</actionGroup>
245+
246+
<actionGroup name="ChangeSeoUrlKey">
247+
<arguments>
248+
<argument name="value" type="string"/>
249+
</arguments>
250+
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection"/>
251+
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{value}}" stepKey="enterURLKey"/>
252+
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
253+
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessage"/>
254+
</actionGroup>
255+
256+
<actionGroup name="ChangeSeoUrlKeyForSubCategory">
257+
<arguments>
258+
<argument name="value" type="string"/>
259+
</arguments>
260+
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection"/>
261+
<uncheckOption selector="{{AdminCategorySEOSection.UrlKeyDefaultValueCheckbox}}" stepKey="uncheckDefaultValue"/>
262+
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{value}}" stepKey="enterURLKey"/>
263+
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
264+
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessage"/>
265+
</actionGroup>
244266
</actionGroups>

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,19 @@
6666
<click selector="{{StorefrontCategoryMainSection.modeListButton}}" stepKey="switchCategoryViewToListMode"/>
6767
<waitForElement selector="{{StorefrontCategoryMainSection.CategoryTitle}}" time="30" stepKey="waitForCategoryReload"/>
6868
</actionGroup>
69+
70+
<actionGroup name="GoToSubCategoryPage">
71+
<arguments>
72+
<argument name="parentCategory"/>
73+
<argument name="subCategory"/>
74+
<argument name="urlPath" type="string"/>
75+
</arguments>
76+
<moveMouseOver selector="{{StorefrontHeaderSection.NavigationCategoryByName(parentCategory.name)}}" stepKey="moveMouseOnMainCategory"/>
77+
<waitForElementVisible selector="{{StorefrontHeaderSection.NavigationCategoryByName(subCategory.name)}}" stepKey="waitForSubCategoryVisible"/>
78+
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName(subCategory.name)}}" stepKey="goToCategory"/>
79+
<waitForPageLoad stepKey="waitForPageLoad"/>
80+
<seeInCurrentUrl url="{{urlPath}}.html" stepKey="checkUrl"/>
81+
<seeInTitle userInput="{{subCategory.name}}" stepKey="assertCategoryNameInTitle"/>
82+
<see userInput="{{subCategory.name}}" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="assertCategoryName"/>
83+
</actionGroup>
6984
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
<element name="uploadImageFile" type="input" selector=".file-uploader-area>input"/>
1616
<element name="imageFileName" type="text" selector=".file-uploader-filename"/>
1717
<element name="removeImageButton" type="button" selector=".file-uploader-summary .action-remove"/>
18+
<element name="AddCMSBlock" type="select" selector="//*[@name='landing_page']"/>
1819
</section>
1920
</sections>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminCategoryDisplaySettingsSection">
12+
<element name="settingsHeader" type="button" selector="//*[contains(text(),'Display Settings')]" timeout="30"/>
13+
<element name="displayMode" type="button" selector="//*[@name='display_mode']"/>
14+
</section>
15+
</sections>

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(
4545
}
4646

4747
/**
48-
* {@inheritdoc}
48+
* @inheritdoc
4949
* @since 101.1.0
5050
*/
5151
public function modifyData(array $data)
@@ -54,8 +54,11 @@ public function modifyData(array $data)
5454
}
5555

5656
/**
57-
* {@inheritdoc}
57+
* Add tier price info to meta array.
58+
*
5859
* @since 101.1.0
60+
* @param array $meta
61+
* @return array
5962
*/
6063
public function modifyMeta(array $meta)
6164
{
@@ -150,8 +153,8 @@ private function getUpdatedTierPriceStructure(array $priceMeta)
150153
'dataType' => Price::NAME,
151154
'addbefore' => '%',
152155
'validation' => [
153-
'validate-number' => true,
154-
'less-than-equals-to' => 100
156+
'required-entry' => true,
157+
'validate-positive-percent-decimal' => true
155158
],
156159
'visible' => $firstOption
157160
&& $firstOption['value'] == ProductPriceOptionsInterface::VALUE_PERCENT,
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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\CatalogGraphQl\Model;
9+
10+
use Magento\Catalog\Api\ProductRepositoryInterface;
11+
12+
/**
13+
* Product data provider
14+
*
15+
* TODO: will be replaces on deferred mechanism
16+
*/
17+
class ProductDataProvider
18+
{
19+
/**
20+
* @var ProductRepositoryInterface
21+
*/
22+
private $productRepository;
23+
24+
/**
25+
* @param ProductRepositoryInterface $productRepository
26+
*/
27+
public function __construct(ProductRepositoryInterface $productRepository)
28+
{
29+
$this->productRepository = $productRepository;
30+
}
31+
32+
/**
33+
* Get product data by id
34+
*
35+
* @param int $productId
36+
* @return array
37+
*/
38+
public function getProductDataById(int $productId): array
39+
{
40+
$product = $this->productRepository->getById($productId);
41+
$productData = $product->toArray();
42+
$productData['model'] = $product;
43+
return $productData;
44+
}
45+
}

app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/DataProvider.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@ public function prepareProductIndex($indexData, $productData, $storeId)
570570
}
571571
}
572572
foreach ($indexData as $entityId => $attributeData) {
573-
foreach ($attributeData as $attributeId => $attributeValue) {
574-
$value = $this->getAttributeValue($attributeId, $attributeValue, $storeId);
573+
foreach ($attributeData as $attributeId => $attributeValues) {
574+
$value = $this->getAttributeValue($attributeId, $attributeValues, $storeId);
575575
if (!empty($value)) {
576576
if (isset($index[$attributeId])) {
577577
$index[$attributeId][$entityId] = $value;
@@ -602,16 +602,16 @@ public function prepareProductIndex($indexData, $productData, $storeId)
602602
* Retrieve attribute source value for search
603603
*
604604
* @param int $attributeId
605-
* @param mixed $valueId
605+
* @param mixed $valueIds
606606
* @param int $storeId
607607
* @return string
608608
*/
609-
private function getAttributeValue($attributeId, $valueId, $storeId)
609+
private function getAttributeValue($attributeId, $valueIds, $storeId)
610610
{
611611
$attribute = $this->getSearchableAttribute($attributeId);
612-
$value = $this->engine->processAttributeValue($attribute, $valueId);
612+
$value = $this->engine->processAttributeValue($attribute, $valueIds);
613613
if (false !== $value) {
614-
$optionValue = $this->getAttributeOptionValue($attributeId, $valueId, $storeId);
614+
$optionValue = $this->getAttributeOptionValue($attributeId, $valueIds, $storeId);
615615
if (null === $optionValue) {
616616
$value = $this->filterAttributeValue($value);
617617
} else {
@@ -626,13 +626,15 @@ private function getAttributeValue($attributeId, $valueId, $storeId)
626626
* Get attribute option value
627627
*
628628
* @param int $attributeId
629-
* @param int $valueId
629+
* @param int|string $valueIds
630630
* @param int $storeId
631631
* @return null|string
632632
*/
633-
private function getAttributeOptionValue($attributeId, $valueId, $storeId)
633+
private function getAttributeOptionValue($attributeId, $valueIds, $storeId)
634634
{
635635
$optionKey = $attributeId . '-' . $storeId;
636+
$attributeValueIds = explode(',', $valueIds);
637+
$attributeOptionValue = '';
636638
if (!array_key_exists($optionKey, $this->attributeOptions)
637639
) {
638640
$attribute = $this->getSearchableAttribute($attributeId);
@@ -650,8 +652,12 @@ private function getAttributeOptionValue($attributeId, $valueId, $storeId)
650652
$this->attributeOptions[$optionKey] = null;
651653
}
652654
}
653-
654-
return $this->attributeOptions[$optionKey][$valueId] ?? null;
655+
foreach ($attributeValueIds as $attrValueId) {
656+
if (isset($this->attributeOptions[$optionKey][$attrValueId])) {
657+
$attributeOptionValue .= $this->attributeOptions[$optionKey][$attrValueId] . ' ';
658+
}
659+
}
660+
return empty($attributeOptionValue) ? null : trim($attributeOptionValue);
655661
}
656662

657663
/**

0 commit comments

Comments
 (0)