diff --git a/Task/Schedule.php b/Task/Schedule.php index 4720fb4..eb1e1f6 100644 --- a/Task/Schedule.php +++ b/Task/Schedule.php @@ -107,6 +107,14 @@ public function getExpression() { return $this->cron->getExpression(); } + /** + * @param string $value + */ + public function setExpression(string $value) { + $this->cron->setExpression($value); + return $this; + } + /** * Return true if the schedule is due to now * @param $currentTime diff --git a/Tests/Task/ScheduleTest.php b/Tests/Task/ScheduleTest.php index 1dd9d2e..9afdfe9 100644 --- a/Tests/Task/ScheduleTest.php +++ b/Tests/Task/ScheduleTest.php @@ -70,4 +70,13 @@ public function testDaily() { "1 2 * 4 5" ); } + public function testSetExpression() { + $schedule = new Schedule("* * * * *"); + $schedule->setExpression("0 * * * *"); + + $this->assertEquals( + $schedule->getExpression(), + "0 * * * *" + ); + } } \ No newline at end of file