Exemple #1
0
 /**
  * Testing method execution
  */
 public function testGet()
 {
     $job1 = ['schedule' => ['cron_expr' => '* * * * *']];
     $job2 = ['schedule' => ['cron_expr' => '1 1 1 1 1']];
     $data = ['crontab' => ['default' => ['jobs' => ['job1' => $job1, 'job2' => $job2]]]];
     $this->_defaultReader->expects($this->once())->method('read')->will($this->returnValue($data));
     $expected = ['default' => ['job1' => ['schedule' => $job1['schedule']['cron_expr']], 'job2' => ['schedule' => $job2['schedule']['cron_expr']]]];
     $result = $this->_reader->get();
     $this->assertEquals($expected['default']['job1']['schedule'], $result['default']['job1']['schedule']);
     $this->assertEquals($expected['default']['job2']['schedule'], $result['default']['job2']['schedule']);
 }
Exemple #2
0
 /**
  * Initialize parameters
  *
  * @param \Magento\Cron\Model\Config\Reader\Xml $reader
  * @param \Magento\Framework\Config\CacheInterface        $cache
  * @param \Magento\Cron\Model\Config\Reader\Db  $dbReader
  * @param string                               $cacheId
  */
 public function __construct(\Magento\Cron\Model\Config\Reader\Xml $reader, \Magento\Framework\Config\CacheInterface $cache, \Magento\Cron\Model\Config\Reader\Db $dbReader, $cacheId = 'crontab_config_cache')
 {
     parent::__construct($reader, $cache, $cacheId);
     $this->merge($dbReader->get());
 }