Skip to content

Commit e062546

Browse files
committed
ACP2E-1243: the catalog_index_refresh_price cron fails with an error that is only reported when run between 0000 and 0059 UTC
1 parent eb1e3a0 commit e062546

File tree

2 files changed

+12
-26
lines changed

2 files changed

+12
-26
lines changed

app/code/Magento/Catalog/Cron/RefreshSpecialPrices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ protected function _refreshSpecialPriceByStore($storeId, $attrCode, $attrConditi
164164
$attrConditionValue
165165
);
166166

167-
$selectData = $connection->fetchCol($select, $identifierField);
167+
$selectData = $connection->fetchCol($select);
168168

169169
if (!empty($selectData)) {
170170
$this->_processor->getIndexer()->reindexList($selectData);

app/code/Magento/Catalog/Test/Unit/Cron/RefreshSpecialPricesTest.php

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Magento\Framework\EntityManager\MetadataPool;
1919
use Magento\Framework\Stdlib\DateTime;
2020
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
21-
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
2221
use Magento\Indexer\Model\Indexer;
2322
use Magento\Store\Model\Store;
2423
use Magento\Store\Model\StoreManagerInterface;
@@ -30,11 +29,6 @@
3029
*/
3130
class RefreshSpecialPricesTest extends TestCase
3231
{
33-
/**
34-
* @var ObjectManager
35-
*/
36-
protected $_objectManager;
37-
3832
/**
3933
* @var RefreshSpecialPrices
4034
*/
@@ -82,8 +76,6 @@ class RefreshSpecialPricesTest extends TestCase
8276

8377
protected function setUp(): void
8478
{
85-
$this->_objectManager = new ObjectManager($this);
86-
8779
$this->_storeManagerMock = $this->getMockForAbstractClass(StoreManagerInterface::class);
8880
$this->_resourceMock = $this->createMock(ResourceConnection::class);
8981
$this->_dateTimeMock = $this->createMock(DateTime::class);
@@ -93,16 +85,13 @@ protected function setUp(): void
9385

9486
$this->metadataMock = $this->createMock(EntityMetadata::class);
9587

96-
$this->_model = $this->_objectManager->getObject(
97-
RefreshSpecialPrices::class,
98-
[
99-
'storeManager' => $this->_storeManagerMock,
100-
'resource' => $this->_resourceMock,
101-
'dateTime' => $this->_dateTimeMock,
102-
'localeDate' => $this->_localeDateMock,
103-
'eavConfig' => $this->_eavConfigMock,
104-
'processor' => $this->_priceProcessorMock
105-
]
88+
$this->_model = new RefreshSpecialPrices(
89+
$this->_storeManagerMock,
90+
$this->_resourceMock,
91+
$this->_dateTimeMock,
92+
$this->_localeDateMock,
93+
$this->_eavConfigMock,
94+
$this->_priceProcessorMock
10695
);
10796

10897
$this->metadataPool = $this->createMock(MetadataPool::class);
@@ -132,13 +121,10 @@ public function testRefreshSpecialPrices()
132121

133122
$connectionMock = $this->getMockForAbstractClass(AdapterInterface::class);
134123
$connectionMock->expects($this->any())->method('select')->willReturn($selectMock);
135-
$connectionMock->expects(
136-
$this->any()
137-
)->method(
138-
'fetchCol'
139-
)->willReturn(
140-
$idsToProcess
141-
);
124+
$connectionMock->expects($this->exactly(2))
125+
->method('fetchCol')
126+
->with($selectMock, [])
127+
->willReturn($idsToProcess);
142128

143129
$this->_resourceMock->expects(
144130
$this->once()

0 commit comments

Comments
 (0)