Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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