DailyCatalogUpdateTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\CatalogRule\Test\Unit\Cron;
  7. use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
  8. class DailyCatalogUpdateTest extends \PHPUnit\Framework\TestCase
  9. {
  10. /**
  11. * Processor
  12. *
  13. * @var \Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor|\PHPUnit_Framework_MockObject_MockObject
  14. */
  15. protected $ruleProductProcessor;
  16. /**
  17. * Cron object
  18. *
  19. * @var \Magento\CatalogRule\Cron\DailyCatalogUpdate
  20. */
  21. protected $cron;
  22. protected function setUp()
  23. {
  24. $this->ruleProductProcessor = $this->createMock(
  25. \Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor::class
  26. );
  27. $this->cron = (new ObjectManager($this))->getObject(
  28. \Magento\CatalogRule\Cron\DailyCatalogUpdate::class,
  29. [
  30. 'ruleProductProcessor' => $this->ruleProductProcessor,
  31. ]
  32. );
  33. }
  34. public function testDailyCatalogUpdate()
  35. {
  36. $this->ruleProductProcessor->expects($this->once())->method('markIndexerAsInvalid');
  37. $this->cron->execute();
  38. }
  39. }