Skip to content

Commit

Permalink
🔃 [Magento Community Engineering] Community Contributions - 2.4-devel…
Browse files Browse the repository at this point in the history
…op 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
  • Loading branch information
magento-engcom-team committed Jul 11, 2020
2 parents 3817060 + 855be72 commit 1ee7e1f
Show file tree
Hide file tree
Showing 12 changed files with 286 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,25 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator;

use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing;
use Magento\CatalogImportExport\Model\Import\Product;
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface;
use Magento\CatalogImportExport\Model\Import\Product\StoreResolver;
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator;
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractPrice;
use Magento\Customer\Api\GroupRepositoryInterface;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\Exception\LocalizedException;

class TierPrice extends \Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractPrice
class TierPrice extends AbstractPrice
{
/**
* @var \Magento\CatalogImportExport\Model\Import\Product\StoreResolver
* @var StoreResolver
*/
protected $storeResolver;

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

/**
* @param \Magento\Customer\Api\GroupRepositoryInterface $groupRepository
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
* @param \Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver
* @param GroupRepositoryInterface $groupRepository
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param StoreResolver $storeResolver
*/
public function __construct(
\Magento\Customer\Api\GroupRepositoryInterface $groupRepository,
\Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
\Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver
GroupRepositoryInterface $groupRepository,
SearchCriteriaBuilder $searchCriteriaBuilder,
StoreResolver $storeResolver
) {
$this->storeResolver = $storeResolver;
parent::__construct($groupRepository, $searchCriteriaBuilder);
}

/**
* {@inheritdoc}
* Initialize method
*
* @param Product $context
*
* @return RowValidatorInterface|AbstractImportValidator|void
* @throws LocalizedException
*/
public function init($context)
{
Expand All @@ -52,7 +67,10 @@ public function init($context)
}

/**
* Add decimal error
*
* @param string $attribute
*
* @return void
*/
protected function addDecimalError($attribute)
Expand Down Expand Up @@ -83,12 +101,12 @@ public function getCustomerGroups()
}

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* Validation
*
* @param mixed $value
* @return bool
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
public function isValid($value)
{
Expand Down Expand Up @@ -133,6 +151,7 @@ public function isValid($value)
* Check if at list one value and length are valid
*
* @param array $value
*
* @return bool
*/
protected function isValidValueAndLength(array $value)
Expand All @@ -150,6 +169,7 @@ protected function isValidValueAndLength(array $value)
* Check if value has empty columns
*
* @param array $value
*
* @return bool
*/
protected function hasEmptyColumns(array $value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,24 @@
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator;

use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing;
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface;
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator;

/**
* Class TierPriceType validates tier price type.
*/
class TierPriceType extends \Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator
class TierPriceType extends AbstractImportValidator
{
/**
* {@inheritdoc}
*/
public function init($context)
{
return parent::init($context);
}

/**
* Validate tier price type.
*
* @param array $value
*
* @return bool
*/
public function isValid($value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,47 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator;

use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing;
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator;
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface;
use Magento\CatalogImportExport\Model\Import\Product\StoreResolver;
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator;
use Magento\Store\Model\Website as WebsiteModel;

class Website extends AbstractImportValidator implements RowValidatorInterface
{
/**
* @var \Magento\CatalogImportExport\Model\Import\Product\StoreResolver
* @var StoreResolver
*/
protected $storeResolver;

/**
* @var \Magento\Store\Model\Website
* @var WebsiteModel
*/
protected $websiteModel;

/**
* @param \Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver
* @param \Magento\Store\Model\Website $websiteModel
* @param StoreResolver $storeResolver
* @param WebsiteModel $websiteModel
*/
public function __construct(
\Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver,
\Magento\Store\Model\Website $websiteModel
StoreResolver $storeResolver,
WebsiteModel $websiteModel
) {
$this->storeResolver = $storeResolver;
$this->websiteModel = $websiteModel;
}

/**
* {@inheritdoc}
*/
public function init($context)
{
return parent::init($context);
}

/**
* Validate by website type
*
* @param array $value
* @param string $websiteCode
*
* @return bool
*/
protected function isWebsiteValid($value, $websiteCode)
Expand All @@ -62,7 +60,8 @@ protected function isWebsiteValid($value, $websiteCode)
/**
* Validate value
*
* @param mixed $value
* @param array $value
*
* @return bool
*/
public function isValid($value)
Expand All @@ -85,6 +84,7 @@ public function isValid($value)
*/
public function getAllWebsitesValue()
{
return AdvancedPricing::VALUE_ALL_WEBSITES . ' ['.$this->websiteModel->getBaseCurrency()->getCurrencyCode().']';
return AdvancedPricing::VALUE_ALL_WEBSITES .
' [' . $this->websiteModel->getBaseCurrency()->getCurrencyCode() . ']';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/>
<!--Open Index Management Page and Select Index mode "Update by Schedule" -->
<magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" />
<!-- Run cron twice -->
<magentoCLI command="cron:run" arguments="--group=index" stepKey="runCron1"/>
<magentoCLI command="cron:run" arguments="--group=index" stepKey="runCron2"/>
<!-- Run cron -->
<magentoCron stepKey="runIndexCronJobs" groups="index"/>
</before>
<after>
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/>
<!--Open Index Management Page and Select Index mode "Update by Schedule" -->
<magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" />
<!-- Run cron twice -->
<magentoCLI command="cron:run" arguments="--group=index" stepKey="runCron1"/>
<magentoCLI command="cron:run" arguments="--group=index" stepKey="runCron2"/>
<!-- Run cron -->
<magentoCron stepKey="runIndexCronJobs" groups="index"/>
</before>
<after>
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/>
<!--Open Index Management Page and Select Index mode "Update by Schedule" -->
<magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" />
<!-- Run cron twice -->
<magentoCLI command="cron:run" arguments="--group=index" stepKey="runCron1"/>
<magentoCLI command="cron:run" arguments="--group=index" stepKey="runCron2"/>
<!-- Run cron -->
<magentoCron stepKey="runIndexCronJobs" groups="index"/>
</before>
<after>
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 1"/>
<!--Open Index Management Page and Select Index mode "Update by Schedule" -->
<magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" />
<!-- Run cron twice -->
<magentoCLI command="cron:run" stepKey="runCron1"/>
<magentoCLI command="cron:run" stepKey="runCron2"/>
<!-- Run cron -->
<magentoCron stepKey="runAllCronJobs"/>
</before>
<after>
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,8 @@
<see userInput="You saved the rule." selector="{{ContentManagementSection.StoreConfigurationPageSuccessMessage}}" stepKey="seeMessage"/>
<see userInput="Updated rules applied." selector="{{ContentManagementSection.StoreConfigurationPageSuccessMessage}}" stepKey="seeSuccessMessage"/>

<!-- Run cron twice -->
<magentoCLI command="cron:run" stepKey="runCron1"/>
<magentoCLI command="cron:run" stepKey="runCron2"/>
<!-- Run cron -->
<magentoCron stepKey="runAllCronJobs"/>
<magentoCLI command="cache:flush" stepKey="flushCache"/>

<!-- Go to Frontend and open the simple product -->
Expand Down
Loading

0 comments on commit 1ee7e1f

Please sign in to comment.