ruleProductProcessor = $this->createMock( \Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor::class ); $this->cron = (new ObjectManager($this))->getObject( \Magento\CatalogRule\Cron\DailyCatalogUpdate::class, [ 'ruleProductProcessor' => $this->ruleProductProcessor, ] ); } public function testDailyCatalogUpdate() { $this->ruleProductProcessor->expects($this->once())->method('markIndexerAsInvalid'); $this->cron->execute(); } }