Skip to content

Commit

Permalink
add every2/3/4minutes to scheduler (#33379)
Browse files Browse the repository at this point in the history
  • Loading branch information
SjorsO authored Jun 29, 2020
1 parent 9631e15 commit 5c841b3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
30 changes: 30 additions & 0 deletions src/Illuminate/Console/Scheduling/ManagesFrequencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,36 @@ public function everyMinute()
return $this->spliceIntoPosition(1, '*');
}

/**
* Schedule the event to run every two minutes.
*
* @return $this
*/
public function everyTwoMinutes()
{
return $this->spliceIntoPosition(1, '*/2');
}

/**
* Schedule the event to run every three minutes.
*
* @return $this
*/
public function everyThreeMinutes()
{
return $this->spliceIntoPosition(1, '*/3');
}

/**
* Schedule the event to run every four minutes.
*
* @return $this
*/
public function everyFourMinutes()
{
return $this->spliceIntoPosition(1, '*/4');
}

/**
* Schedule the event to run every five minutes.
*
Expand Down
5 changes: 4 additions & 1 deletion tests/Console/Scheduling/FrequencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ public function testEveryMinute()
$this->assertSame('* * * * *', $this->event->everyMinute()->getExpression());
}

public function testEveryFiveMinutes()
public function testEveryXMinutes()
{
$this->assertSame('*/2 * * * *', $this->event->everyTwoMinutes()->getExpression());
$this->assertSame('*/3 * * * *', $this->event->everyThreeMinutes()->getExpression());
$this->assertSame('*/4 * * * *', $this->event->everyFourMinutes()->getExpression());
$this->assertSame('*/5 * * * *', $this->event->everyFiveMinutes()->getExpression());
}

Expand Down

0 comments on commit 5c841b3

Please sign in to comment.