Skip to content

Commit 1ee7e1f

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.4-develop daily delivery
Accepted Community Pull Requests: - #28898: Sample Files for Unsalable Products Redirect Instead of Download (by @engcom-Charlie) - #28852: [MFTF] Remove redundant cron run (by @Usik2203) - #28812: MFTF: Sharing Wishlist with more than allowed Text Length Limit (by @DmitryTsymbal) - #28650: Remove redundant init method (by @Usik2203) Fixed GitHub Issues: - #23638: Sample Files for Unsalable Products Redirect Instead of Download (reported by @samuel-reinhardt) has been fixed in #28898 by @engcom-Charlie in 2.4-develop branch Related commits: 1. f9d4e0a 2. 0ea00f0 - #28969: [Issue] MFTF: Sharing Wishlist with more than allowed Text Length Limit (reported by @m2-assistant[bot]) has been fixed in #28812 by @DmitryTsymbal in 2.4-develop branch Related commits: 1. fcb6042 2. 03253e3 3. 53aefb9 - #29009: [Issue] Remove redundant init method (reported by @m2-assistant[bot]) has been fixed in #28650 by @Usik2203 in 2.4-develop branch Related commits: 1. 9104cb5 2. f1516ba 3. 6d43eb1
2 parents 3817060 + 855be72 commit 1ee7e1f

File tree

12 files changed

+286
-78
lines changed

12 files changed

+286
-78
lines changed

app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/TierPrice.php

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,25 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator;
710

811
use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing;
12+
use Magento\CatalogImportExport\Model\Import\Product;
913
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface;
14+
use Magento\CatalogImportExport\Model\Import\Product\StoreResolver;
15+
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator;
16+
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractPrice;
17+
use Magento\Customer\Api\GroupRepositoryInterface;
18+
use Magento\Framework\Api\SearchCriteriaBuilder;
19+
use Magento\Framework\Exception\LocalizedException;
1020

11-
class TierPrice extends \Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractPrice
21+
class TierPrice extends AbstractPrice
1222
{
1323
/**
14-
* @var \Magento\CatalogImportExport\Model\Import\Product\StoreResolver
24+
* @var StoreResolver
1525
*/
1626
protected $storeResolver;
1727

@@ -27,21 +37,26 @@ class TierPrice extends \Magento\CatalogImportExport\Model\Import\Product\Valida
2737
];
2838

2939
/**
30-
* @param \Magento\Customer\Api\GroupRepositoryInterface $groupRepository
31-
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
32-
* @param \Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver
40+
* @param GroupRepositoryInterface $groupRepository
41+
* @param SearchCriteriaBuilder $searchCriteriaBuilder
42+
* @param StoreResolver $storeResolver
3343
*/
3444
public function __construct(
35-
\Magento\Customer\Api\GroupRepositoryInterface $groupRepository,
36-
\Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
37-
\Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver
45+
GroupRepositoryInterface $groupRepository,
46+
SearchCriteriaBuilder $searchCriteriaBuilder,
47+
StoreResolver $storeResolver
3848
) {
3949
$this->storeResolver = $storeResolver;
4050
parent::__construct($groupRepository, $searchCriteriaBuilder);
4151
}
4252

4353
/**
44-
* {@inheritdoc}
54+
* Initialize method
55+
*
56+
* @param Product $context
57+
*
58+
* @return RowValidatorInterface|AbstractImportValidator|void
59+
* @throws LocalizedException
4560
*/
4661
public function init($context)
4762
{
@@ -52,7 +67,10 @@ public function init($context)
5267
}
5368

5469
/**
70+
* Add decimal error
71+
*
5572
* @param string $attribute
73+
*
5674
* @return void
5775
*/
5876
protected function addDecimalError($attribute)
@@ -83,12 +101,12 @@ public function getCustomerGroups()
83101
}
84102

85103
/**
86-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
87104
* Validation
88105
*
89106
* @param mixed $value
90107
* @return bool
91108
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
109+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
92110
*/
93111
public function isValid($value)
94112
{
@@ -133,6 +151,7 @@ public function isValid($value)
133151
* Check if at list one value and length are valid
134152
*
135153
* @param array $value
154+
*
136155
* @return bool
137156
*/
138157
protected function isValidValueAndLength(array $value)
@@ -150,6 +169,7 @@ protected function isValidValueAndLength(array $value)
150169
* Check if value has empty columns
151170
*
152171
* @param array $value
172+
*
153173
* @return bool
154174
*/
155175
protected function hasEmptyColumns(array $value)

app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/TierPriceType.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,24 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
declare(strict_types=1);
8+
79
namespace Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator;
810

911
use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing;
1012
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface;
13+
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator;
1114

1215
/**
1316
* Class TierPriceType validates tier price type.
1417
*/
15-
class TierPriceType extends \Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator
18+
class TierPriceType extends AbstractImportValidator
1619
{
17-
/**
18-
* {@inheritdoc}
19-
*/
20-
public function init($context)
21-
{
22-
return parent::init($context);
23-
}
24-
2520
/**
2621
* Validate tier price type.
2722
*
2823
* @param array $value
24+
*
2925
* @return bool
3026
*/
3127
public function isValid($value)

app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing/Validator/Website.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,47 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator;
710

811
use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing;
9-
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator;
1012
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface;
13+
use Magento\CatalogImportExport\Model\Import\Product\StoreResolver;
14+
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator;
15+
use Magento\Store\Model\Website as WebsiteModel;
1116

1217
class Website extends AbstractImportValidator implements RowValidatorInterface
1318
{
1419
/**
15-
* @var \Magento\CatalogImportExport\Model\Import\Product\StoreResolver
20+
* @var StoreResolver
1621
*/
1722
protected $storeResolver;
1823

1924
/**
20-
* @var \Magento\Store\Model\Website
25+
* @var WebsiteModel
2126
*/
2227
protected $websiteModel;
2328

2429
/**
25-
* @param \Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver
26-
* @param \Magento\Store\Model\Website $websiteModel
30+
* @param StoreResolver $storeResolver
31+
* @param WebsiteModel $websiteModel
2732
*/
2833
public function __construct(
29-
\Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver,
30-
\Magento\Store\Model\Website $websiteModel
34+
StoreResolver $storeResolver,
35+
WebsiteModel $websiteModel
3136
) {
3237
$this->storeResolver = $storeResolver;
3338
$this->websiteModel = $websiteModel;
3439
}
3540

36-
/**
37-
* {@inheritdoc}
38-
*/
39-
public function init($context)
40-
{
41-
return parent::init($context);
42-
}
43-
4441
/**
4542
* Validate by website type
4643
*
4744
* @param array $value
4845
* @param string $websiteCode
46+
*
4947
* @return bool
5048
*/
5149
protected function isWebsiteValid($value, $websiteCode)
@@ -62,7 +60,8 @@ protected function isWebsiteValid($value, $websiteCode)
6260
/**
6361
* Validate value
6462
*
65-
* @param mixed $value
63+
* @param array $value
64+
*
6665
* @return bool
6766
*/
6867
public function isValid($value)
@@ -85,6 +84,7 @@ public function isValid($value)
8584
*/
8685
public function getAllWebsitesValue()
8786
{
88-
return AdvancedPricing::VALUE_ALL_WEBSITES . ' ['.$this->websiteModel->getBaseCurrency()->getCurrencyCode().']';
87+
return AdvancedPricing::VALUE_ALL_WEBSITES .
88+
' [' . $this->websiteModel->getBaseCurrency()->getCurrencyCode() . ']';
8989
}
9090
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@
3737
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/>
3838
<!--Open Index Management Page and Select Index mode "Update by Schedule" -->
3939
<magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" />
40-
<!-- Run cron twice -->
41-
<magentoCLI command="cron:run" arguments="--group=index" stepKey="runCron1"/>
42-
<magentoCLI command="cron:run" arguments="--group=index" stepKey="runCron2"/>
40+
<!-- Run cron -->
41+
<magentoCron stepKey="runIndexCronJobs" groups="index"/>
4342
</before>
4443
<after>
4544
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/>

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@
3737
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/>
3838
<!--Open Index Management Page and Select Index mode "Update by Schedule" -->
3939
<magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" />
40-
<!-- Run cron twice -->
41-
<magentoCLI command="cron:run" arguments="--group=index" stepKey="runCron1"/>
42-
<magentoCLI command="cron:run" arguments="--group=index" stepKey="runCron2"/>
40+
<!-- Run cron -->
41+
<magentoCron stepKey="runIndexCronJobs" groups="index"/>
4342
</before>
4443
<after>
4544
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/>

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@
3737
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/>
3838
<!--Open Index Management Page and Select Index mode "Update by Schedule" -->
3939
<magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" />
40-
<!-- Run cron twice -->
41-
<magentoCLI command="cron:run" arguments="--group=index" stepKey="runCron1"/>
42-
<magentoCLI command="cron:run" arguments="--group=index" stepKey="runCron2"/>
40+
<!-- Run cron -->
41+
<magentoCron stepKey="runIndexCronJobs" groups="index"/>
4342
</before>
4443
<after>
4544
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/>

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@
3838
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/>
3939
<!--Open Index Management Page and Select Index mode "Update by Schedule" -->
4040
<magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" />
41-
<!-- Run cron twice -->
42-
<magentoCLI command="cron:run" stepKey="runCron1"/>
43-
<magentoCLI command="cron:run" stepKey="runCron2"/>
41+
<!-- Run cron -->
42+
<magentoCron stepKey="runAllCronJobs"/>
4443
</before>
4544
<after>
4645
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/>

app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogPriceRuleByProductAttributeTest.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,8 @@
232232
<see userInput="You saved the rule." selector="{{ContentManagementSection.StoreConfigurationPageSuccessMessage}}" stepKey="seeMessage"/>
233233
<see userInput="Updated rules applied." selector="{{ContentManagementSection.StoreConfigurationPageSuccessMessage}}" stepKey="seeSuccessMessage"/>
234234

235-
<!-- Run cron twice -->
236-
<magentoCLI command="cron:run" stepKey="runCron1"/>
237-
<magentoCLI command="cron:run" stepKey="runCron2"/>
235+
<!-- Run cron -->
236+
<magentoCron stepKey="runAllCronJobs"/>
238237
<magentoCLI command="cache:flush" stepKey="flushCache"/>
239238

240239
<!-- Go to Frontend and open the simple product -->

0 commit comments

Comments
 (0)