Skip to content

Commit

Permalink
ENGCOM-4440: Fix for issue #21510: Can't access backend indexers page…
Browse files Browse the repository at this point in the history
… after creating a custom index #21575
  • Loading branch information
sidolov authored Mar 18, 2019
2 parents a7f930a + 3097a70 commit 40b5feb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app/code/Magento/Indexer/Model/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Indexer\Model;

use Magento\Framework\Indexer\ActionFactory;
Expand All @@ -14,6 +15,8 @@
use Magento\Framework\Indexer\StructureFactory;

/**
* Indexer model.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Indexer extends \Magento\Framework\DataObject implements IndexerInterface
Expand Down Expand Up @@ -361,7 +364,7 @@ public function getLatestUpdated()
return $this->getView()->getUpdated();
}
}
return $this->getState()->getUpdated();
return $this->getState()->getUpdated() ?: '';
}

/**
Expand Down
10 changes: 8 additions & 2 deletions app/code/Magento/Indexer/Test/Unit/Model/IndexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ public function testGetLatestUpdated($getViewIsEnabled, $getViewGetUpdated, $get
}
}
} else {
$this->assertEquals($getStateGetUpdated, $this->model->getLatestUpdated());
$getLatestUpdated = $this->model->getLatestUpdated();
$this->assertEquals($getStateGetUpdated, $getLatestUpdated);

if ($getStateGetUpdated === null) {
$this->assertNotNull($getLatestUpdated);
}
}
}

Expand All @@ -182,7 +187,8 @@ public function getLatestUpdatedDataProvider()
[true, '', '06-Jan-1944'],
[true, '06-Jan-1944', ''],
[true, '', ''],
[true, '06-Jan-1944', '05-Jan-1944']
[true, '06-Jan-1944', '05-Jan-1944'],
[false, null, null],
];
}

Expand Down

0 comments on commit 40b5feb

Please sign in to comment.