Crunz\Event::cron PHP Method

cron() public method

The Cron expression representing the event's frequency.
public cron ( string $expression )
$expression string
    public function cron($expression)
    {
        $this->expression = $expression;
        return $this;
    }

Usage Example

Example #1
0
 public function testCronConditions()
 {
     $e = new Event($this->id, 'php foo');
     $this->assertFalse($e->cron('* * * * * *')->when(function () {
         return false;
     })->isDue());
     $e = new Event($this->id, 'php foo');
     $this->assertTrue($e->cron('* * * * * *')->when(function () {
         return true;
     })->isDue());
     $e = new Event($this->id, 'php foo');
     $this->assertFalse($e->cron('* * * * * *')->skip(function () {
         return true;
     })->isDue());
     $e = new Event($this->id, 'php foo');
     $this->assertTrue($e->cron('* * * * * *')->skip(function () {
         return false;
     })->isDue());
 }