Skip to content

Commit

Permalink
[5.3] Add HourlyAt() option for scheduled events (#17168)
Browse files Browse the repository at this point in the history
* Update Event.php

* Update ConsoleScheduledEventTest.php

* Update ConsoleScheduledEventTest.php

* Update ConsoleScheduledEventTest.php

* Update Event.php

* Change string to int
  • Loading branch information
laurencei authored and taylorotwell committed Jan 6, 2017
1 parent aaa989f commit 805fde3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Illuminate/Console/Scheduling/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,17 @@ public function hourly()
return $this->spliceIntoPosition(1, 0);
}

/**
* Schedule the event to run hourly at a given offset in the hour.
*
* @param int $offset
* @return $this
*/
public function hourlyAt($offset)
{
return $this->spliceIntoPosition(1, $offset);
}

/**
* Schedule the event to run daily.
*
Expand Down
3 changes: 3 additions & 0 deletions tests/Console/ConsoleScheduledEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public function testBasicCronCompilation()
$event = new Event('php foo');
$this->assertEquals('0 * * * * *', $event->everyFiveMinutes()->hourly()->getExpression());

$event = new Event('php foo');
$this->assertEquals('37 * * * * *', $event->hourlyAt(37)->getExpression());

$event = new Event('php foo');
$this->assertEquals('0 15 4 * * *', $event->monthlyOn(4, '15:00')->getExpression());

Expand Down

0 comments on commit 805fde3

Please sign in to comment.