Skip to content

Commit 3ab3e6b

Browse files
committed
Merge branch 'B2B-1650' into foxes-pr
2 parents 713f5c7 + 83fb35a commit 3ab3e6b

File tree

159 files changed

+3702
-643
lines changed

Some content is hidden

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

159 files changed

+3702
-643
lines changed

app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export/GetFilter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public function execute()
3434
/** @var $export \Magento\ImportExport\Model\Export */
3535
$export = $this->_objectManager->create(\Magento\ImportExport\Model\Export::class);
3636
$export->setData($data);
37-
$export->filterAttributeCollection(
38-
$attrFilterBlock->prepareCollection($export->getEntityAttributeCollection())
37+
$attrFilterBlock->prepareCollection(
38+
$export->filterAttributeCollection($export->getEntityAttributeCollection())
3939
);
4040
return $resultLayout;
4141
} catch (\Exception $e) {
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="AwsS3AdminImportSimpleAndConfigurableProductsWithAssignedImagesTest" extends="AdminImportSimpleAndConfigurableProductsWithAssignedImagesTest">
11+
<test name="AdminAwsS3ImportSimpleAndConfigurableProductsWithAssignedImagesTest" extends="AdminImportSimpleAndConfigurableProductsWithAssignedImagesTest">
1212
<annotations>
1313
<features value="AwsS3"/>
1414
<stories value="Import Products"/>
@@ -18,6 +18,7 @@
1818
products as expected."/>
1919
<severity value="MAJOR"/>
2020
<group value="importExport"/>
21+
<group value="ConfigurableProduct"/>
2122
<group value="remote_storage_aws_s3"/>
2223
<skip>
2324
<issueId value="MC-39280"/>
@@ -26,12 +27,12 @@
2627

2728
<before>
2829
<!-- Enable AWS S3 Remote Storage -->
29-
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.enable_options}}" stepKey="enableRemoteStorage"/>
30+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.enable_options}}" stepKey="enableRemoteStorage" before="createImportProductAttribute"/>
3031
</before>
3132

3233
<after>
3334
<!-- Disable AWS S3 Remote Storage -->
34-
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage"/>
35+
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage" after="logoutFromAdmin"/>
3536
</after>
3637
</test>
3738
</tests>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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\Backend\Model\Validator\UrlKey;
9+
10+
/**
11+
* Class Composite validates if urlKey doesn't matches frontName or restricted words(endpoint names)
12+
*/
13+
class CompositeUrlKey implements UrlKeyValidatorInterface
14+
{
15+
/**
16+
* @var UrlKeyValidatorInterface[]
17+
*/
18+
private $validators;
19+
20+
/**
21+
* @param array $validators
22+
*/
23+
public function __construct(
24+
array $validators = []
25+
) {
26+
$this->validators = $validators;
27+
}
28+
29+
/**
30+
* @inheritDoc
31+
*/
32+
public function validate(string $urlKey): array
33+
{
34+
$errors = [];
35+
foreach ($this->validators as $validator) {
36+
$errors[] = $validator->validate($urlKey);
37+
}
38+
39+
return array_merge([], ...$errors);
40+
}
41+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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\Backend\Model\Validator\UrlKey;
9+
10+
use Magento\Backend\App\Area\FrontNameResolver;
11+
12+
/**
13+
* Class FrontName validates if urlKey doesn't matches frontName
14+
*/
15+
class FrontName implements UrlKeyValidatorInterface
16+
{
17+
/**
18+
* @var FrontNameResolver
19+
*/
20+
private $frontNameResolver;
21+
22+
/**
23+
* @param FrontNameResolver $frontNameResolver
24+
*/
25+
public function __construct(
26+
FrontNameResolver $frontNameResolver
27+
) {
28+
$this->frontNameResolver = $frontNameResolver;
29+
}
30+
31+
/**
32+
* @inheritDoc
33+
*/
34+
public function validate(string $urlKey): array
35+
{
36+
$errors = [];
37+
$frontName = $this->frontNameResolver->getFrontName();
38+
if ($urlKey == $frontName) {
39+
$errors[] = __(
40+
'URL key "%1" matches a reserved endpoint name (%2). Use another URL key.',
41+
$urlKey,
42+
$frontName
43+
);
44+
}
45+
46+
return $errors;
47+
}
48+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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\Backend\Model\Validator\UrlKey;
9+
10+
use Magento\Framework\Validator\UrlKey;
11+
12+
/**
13+
* Class RestrictedWords validates if urlKey doesn't matches restricted words(endpoint names)
14+
*/
15+
class RestrictedWords implements UrlKeyValidatorInterface
16+
{
17+
/**
18+
* @var UrlKey
19+
*/
20+
private $urlKey;
21+
22+
/**
23+
* @param UrlKey $urlKey
24+
*/
25+
public function __construct(
26+
UrlKey $urlKey
27+
) {
28+
$this->urlKey = $urlKey;
29+
}
30+
31+
/**
32+
* @inheritDoc
33+
*/
34+
public function validate(string $urlKey): array
35+
{
36+
$errors = [];
37+
if (!$this->urlKey->isValid($urlKey)) {
38+
$errors[] = __(
39+
'URL key "%1" matches a reserved endpoint name (%2). Use another URL key.',
40+
$urlKey,
41+
implode(', ', $this->urlKey->getRestrictedValues())
42+
);
43+
}
44+
45+
return $errors;
46+
}
47+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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\Backend\Model\Validator\UrlKey;
9+
10+
/**
11+
* Interface UrlKeyValidatorInterface is responsive for validating urlKeys
12+
*/
13+
interface UrlKeyValidatorInterface
14+
{
15+
/**
16+
* Validates urlKey
17+
*
18+
* @param string $urlKey
19+
* @return array
20+
*/
21+
public function validate(string $urlKey): array;
22+
}

app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@
6969
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
7070
<!-- Place Order -->
7171
<comment userInput="Place order" stepKey="placeOrder"/>
72-
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
73-
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle"/>
72+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/>
73+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="seeSuccessTitle"/>
7474
<see selector="{{CheckoutSuccessMainSection.orderNumberText}}" userInput="Your order number is: " stepKey="seeOrderNumber"/>
7575
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
7676
<!-- Search for Order in the order grid -->

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,12 @@
188188
<argument name="anchorRenderer" xsi:type="object">Magento\Backend\Block\AnchorRenderer</argument>
189189
</arguments>
190190
</type>
191+
<type name="Magento\Backend\Model\Validator\UrlKey\CompositeUrlKey">
192+
<arguments>
193+
<argument name="validators" xsi:type="array">
194+
<item name="frontNameValidator" xsi:type="object">Magento\Backend\Model\Validator\UrlKey\FrontName</item>
195+
<item name="restrictedWordsValidator" xsi:type="object">Magento\Backend\Model\Validator\UrlKey\RestrictedWords</item>
196+
</argument>
197+
</arguments>
198+
</type>
191199
</config>

app/code/Magento/Backend/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,3 +466,4 @@ Pagination,Pagination
466466
"Theme Name","Theme Name"
467467
"Use URL parameter to enable template path hints for Storefront","Use URL parameter to enable template path hints for Storefront"
468468
"Add the following parameter to the URL to show template hints ?templatehints=[parameter_value]","Add the following parameter to the URL to show template hints ?templatehints=[parameter_value]"
469+
"URL key "%1" matches a reserved endpoint name (%2). Use another URL key.","URL key "%1" matches a reserved endpoint name (%2). Use another URL key."

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Catalog\Model;
78

89
use Magento\Framework\App\Filesystem\DirectoryList;
9-
use Magento\Framework\Exception\LocalizedException;
10-
use Magento\Framework\File\Uploader;
1110
use Magento\Framework\App\ObjectManager;
11+
use Magento\Framework\Exception\LocalizedException;
1212
use Magento\Framework\File\Name;
1313
use Magento\Framework\Filesystem;
1414
use Magento\Framework\Filesystem\Directory\WriteInterface;
@@ -211,7 +211,7 @@ public function moveFileFromTmp($imageName, $returnRelativePath = false)
211211
$baseTmpImagePath = $this->getFilePath($baseTmpPath, $imageName);
212212

213213
try {
214-
$this->coreFileStorageDatabase->copyFile(
214+
$this->coreFileStorageDatabase->renameFile(
215215
$baseTmpImagePath,
216216
$baseImagePath
217217
);

0 commit comments

Comments
 (0)