Skip to content

Commit 40b5feb

Browse files
authored
ENGCOM-4440: Fix for issue #21510: Can't access backend indexers page after creating a custom index #21575
2 parents a7f930a + 3097a70 commit 40b5feb

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

app/code/Magento/Indexer/Model/Indexer.php

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

89
use Magento\Framework\Indexer\ActionFactory;
@@ -14,6 +15,8 @@
1415
use Magento\Framework\Indexer\StructureFactory;
1516

1617
/**
18+
* Indexer model.
19+
*
1720
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1821
*/
1922
class Indexer extends \Magento\Framework\DataObject implements IndexerInterface
@@ -361,7 +364,7 @@ public function getLatestUpdated()
361364
return $this->getView()->getUpdated();
362365
}
363366
}
364-
return $this->getState()->getUpdated();
367+
return $this->getState()->getUpdated() ?: '';
365368
}
366369

367370
/**

app/code/Magento/Indexer/Test/Unit/Model/IndexerTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,12 @@ public function testGetLatestUpdated($getViewIsEnabled, $getViewGetUpdated, $get
164164
}
165165
}
166166
} else {
167-
$this->assertEquals($getStateGetUpdated, $this->model->getLatestUpdated());
167+
$getLatestUpdated = $this->model->getLatestUpdated();
168+
$this->assertEquals($getStateGetUpdated, $getLatestUpdated);
169+
170+
if ($getStateGetUpdated === null) {
171+
$this->assertNotNull($getLatestUpdated);
172+
}
168173
}
169174
}
170175

@@ -182,7 +187,8 @@ public function getLatestUpdatedDataProvider()
182187
[true, '', '06-Jan-1944'],
183188
[true, '06-Jan-1944', ''],
184189
[true, '', ''],
185-
[true, '06-Jan-1944', '05-Jan-1944']
190+
[true, '06-Jan-1944', '05-Jan-1944'],
191+
[false, null, null],
186192
];
187193
}
188194

0 commit comments

Comments
 (0)