Skip to content

Commit

Permalink
Add missing Scheduler tests (#34723)
Browse files Browse the repository at this point in the history
  • Loading branch information
u01jmg3 authored Oct 7, 2020
1 parent 17e467c commit ec98e98
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/Console/Scheduling/FrequencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,36 @@ public function testEveryXMinutes()
$this->assertSame('*/3 * * * *', $this->event->everyThreeMinutes()->getExpression());
$this->assertSame('*/4 * * * *', $this->event->everyFourMinutes()->getExpression());
$this->assertSame('*/5 * * * *', $this->event->everyFiveMinutes()->getExpression());
$this->assertSame('*/10 * * * *', $this->event->everyTenMinutes()->getExpression());
$this->assertSame('*/15 * * * *', $this->event->everyFifteenMinutes()->getExpression());
$this->assertSame('0,30 * * * *', $this->event->everyThirtyMinutes()->getExpression());
}

public function testDaily()
{
$this->assertSame('0 0 * * *', $this->event->daily()->getExpression());
}

public function testDailyAt()
{
$this->assertSame('8 13 * * *', $this->event->dailyAt('13:08')->getExpression());
}

public function testTwiceDaily()
{
$this->assertSame('0 3,15 * * *', $this->event->twiceDaily(3, 15)->getExpression());
}

public function testWeekly()
{
$this->assertSame('0 0 * * 0', $this->event->weekly()->getExpression());
}

public function testWeeklyOn()
{
$this->assertSame('0 8 * * 1', $this->event->weeklyOn(1, '8:00')->getExpression());
}

public function testOverrideWithHourly()
{
$this->assertSame('0 * * * *', $this->event->everyFiveMinutes()->hourly()->getExpression());
Expand All @@ -61,11 +79,21 @@ public function testHourly()
$this->assertSame('0 */6 * * *', $this->event->everySixHours()->getExpression());
}

public function testMonthly()
{
$this->assertSame('0 0 1 * *', $this->event->monthly()->getExpression());
}

public function testMonthlyOn()
{
$this->assertSame('0 15 4 * *', $this->event->monthlyOn(4, '15:00')->getExpression());
}

public function testLastDayOfMonth()
{
$this->assertSame('0 0 31 * *', $this->event->lastDayOfMonth()->getExpression());
}

public function testTwiceMonthly()
{
$this->assertSame('0 0 1,16 * *', $this->event->twiceMonthly(1, 16)->getExpression());
Expand Down Expand Up @@ -131,6 +159,11 @@ public function testQuarterly()
$this->assertSame('0 0 1 1-12/3 *', $this->event->quarterly()->getExpression());
}

public function testYearly()
{
$this->assertSame('0 0 1 1 *', $this->event->yearly()->getExpression());
}

public function testFrequencyMacro()
{
Event::macro('everyXMinutes', function ($x) {
Expand Down

0 comments on commit ec98e98

Please sign in to comment.