ConfigTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Cron\Test\Unit\Model;
  7. /**
  8. * Class \Magento\Cron\Model\Config
  9. */
  10. class ConfigTest extends \PHPUnit\Framework\TestCase
  11. {
  12. /**
  13. * @var \Magento\Cron\Model\Config\Data|\PHPUnit_Framework_MockObject_MockObject
  14. */
  15. protected $_configData;
  16. /**
  17. * @var \Magento\Cron\Model\Config
  18. */
  19. protected $_config;
  20. /**
  21. * Prepare data
  22. */
  23. protected function setUp()
  24. {
  25. $this->_configData = $this->getMockBuilder(
  26. \Magento\Cron\Model\Config\Data::class
  27. )->disableOriginalConstructor()->getMock();
  28. $this->_config = new \Magento\Cron\Model\Config($this->_configData);
  29. }
  30. /**
  31. * Test method call
  32. */
  33. public function testGetJobs()
  34. {
  35. $jobList = [
  36. 'jobname1' => ['instance' => 'TestInstance', 'method' => 'testMethod', 'schedule' => '* * * * *'],
  37. ];
  38. $this->_configData->expects($this->once())->method('getJobs')->will($this->returnValue($jobList));
  39. $result = $this->_config->getJobs();
  40. $this->assertEquals($jobList, $result);
  41. }
  42. }