register() public static méthode

register a cron job
See also: Cron::trySchedule() for allowed cron expression syntax
public static register ( string $code, string $frequency, callable $callback, array $args = [] ) : self
$code string the cron job code / identifier
$frequency string cron expression
$callback callable the actual cron job
$args array args to the cron job
Résultat self
 public function testCronRegistry()
 {
     Registry::register('test', '* * * * *', array($this, 'dummy'), array());
     $expectedCronRegistry = array('test' => array('frequency' => '* * * * *', 'callback' => array($this, 'dummy'), 'args' => array()));
     $cronRegistry = Registry::getCronRegistry();
     $this->assertSame($expectedCronRegistry, $cronRegistry);
 }
Exemple #2
0
 /**
  * wrapper function
  * @see Registry::register()
  */
 public static function register($code, $frequency, $callback, array $args = array())
 {
     Registry::register($code, $frequency, $callback, $args);
 }