From 24636f01bf0950220560f5d993826a8b7c725422 Mon Sep 17 00:00:00 2001 From: Mark Beech Date: Tue, 1 Dec 2020 13:46:15 +0000 Subject: [PATCH] Don't overwrite minute and hour when specifying as time with twiceMonthly() (#35436) * Don't overwrite minute and hour * Add test * Style --- src/Illuminate/Console/Scheduling/ManagesFrequencies.php | 4 +--- tests/Console/Scheduling/FrequencyTest.php | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index 540217dd3c4b..7e1cdf17c0a8 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -425,9 +425,7 @@ public function twiceMonthly($first = 1, $second = 16, $time = '0:0') $this->dailyAt($time); - return $this->spliceIntoPosition(1, 0) - ->spliceIntoPosition(2, 0) - ->spliceIntoPosition(3, $daysOfMonth); + return $this->spliceIntoPosition(3, $daysOfMonth); } /** diff --git a/tests/Console/Scheduling/FrequencyTest.php b/tests/Console/Scheduling/FrequencyTest.php index cf2dff84845c..fb9a502aa7ca 100644 --- a/tests/Console/Scheduling/FrequencyTest.php +++ b/tests/Console/Scheduling/FrequencyTest.php @@ -104,6 +104,11 @@ public function testTwiceMonthly() $this->assertSame('0 0 1,16 * *', $this->event->twiceMonthly(1, 16)->getExpression()); } + public function testTwiceMonthlyAtTime() + { + $this->assertSame('30 1 1,16 * *', $this->event->twiceMonthly(1, 16, '1:30')->getExpression()); + } + public function testMonthlyOnWithMinutes() { $this->assertSame('15 15 4 * *', $this->event->monthlyOn(4, '15:15')->getExpression());