Skip to content

Commit 5c841b3

Browse files
authored
add every2/3/4minutes to scheduler (#33379)
1 parent 9631e15 commit 5c841b3

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

src/Illuminate/Console/Scheduling/ManagesFrequencies.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,36 @@ public function everyMinute()
8181
return $this->spliceIntoPosition(1, '*');
8282
}
8383

84+
/**
85+
* Schedule the event to run every two minutes.
86+
*
87+
* @return $this
88+
*/
89+
public function everyTwoMinutes()
90+
{
91+
return $this->spliceIntoPosition(1, '*/2');
92+
}
93+
94+
/**
95+
* Schedule the event to run every three minutes.
96+
*
97+
* @return $this
98+
*/
99+
public function everyThreeMinutes()
100+
{
101+
return $this->spliceIntoPosition(1, '*/3');
102+
}
103+
104+
/**
105+
* Schedule the event to run every four minutes.
106+
*
107+
* @return $this
108+
*/
109+
public function everyFourMinutes()
110+
{
111+
return $this->spliceIntoPosition(1, '*/4');
112+
}
113+
84114
/**
85115
* Schedule the event to run every five minutes.
86116
*

tests/Console/Scheduling/FrequencyTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ public function testEveryMinute()
2828
$this->assertSame('* * * * *', $this->event->everyMinute()->getExpression());
2929
}
3030

31-
public function testEveryFiveMinutes()
31+
public function testEveryXMinutes()
3232
{
33+
$this->assertSame('*/2 * * * *', $this->event->everyTwoMinutes()->getExpression());
34+
$this->assertSame('*/3 * * * *', $this->event->everyThreeMinutes()->getExpression());
35+
$this->assertSame('*/4 * * * *', $this->event->everyFourMinutes()->getExpression());
3336
$this->assertSame('*/5 * * * *', $this->event->everyFiveMinutes()->getExpression());
3437
}
3538

0 commit comments

Comments
 (0)