Skip to content

Commit 4ba06ff

Browse files
committed
MC-13827: Failed funtional test Magento\FunctionalTestingFramework.functional.StorefrontSortingByPriceForConfigurableProductWithCatalogRuleAppliedTest
1 parent 12ee2b3 commit 4ba06ff

File tree

1 file changed

+13
-1
lines changed
  • app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog

1 file changed

+13
-1
lines changed

app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Save.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Framework\Registry;
1212
use Magento\Framework\Stdlib\DateTime\Filter\Date;
1313
use Magento\Framework\App\Request\DataPersistorInterface;
14+
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
1415

1516
/**
1617
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -22,19 +23,27 @@ class Save extends \Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog
2223
*/
2324
protected $dataPersistor;
2425

26+
/**
27+
* @var TimezoneInterface
28+
*/
29+
private $localeDate;
30+
2531
/**
2632
* @param Context $context
2733
* @param Registry $coreRegistry
2834
* @param Date $dateFilter
2935
* @param DataPersistorInterface $dataPersistor
36+
* @param TimezoneInterface $localeDate
3037
*/
3138
public function __construct(
3239
Context $context,
3340
Registry $coreRegistry,
3441
Date $dateFilter,
35-
DataPersistorInterface $dataPersistor
42+
DataPersistorInterface $dataPersistor,
43+
TimezoneInterface $localeDate
3644
) {
3745
$this->dataPersistor = $dataPersistor;
46+
$this->localeDate = $localeDate;
3847
parent::__construct($context, $coreRegistry, $dateFilter);
3948
}
4049

@@ -61,6 +70,9 @@ public function execute()
6170
);
6271
$data = $this->getRequest()->getPostValue();
6372

73+
if (!$this->getRequest()->getParam('from_date')) {
74+
$data['from_date'] = $this->localeDate->formatDate();
75+
}
6476
$filterValues = ['from_date' => $this->_dateFilter];
6577
if ($this->getRequest()->getParam('to_date')) {
6678
$filterValues['to_date'] = $this->_dateFilter;

0 commit comments

Comments
 (0)