From 7088851351bad37603a760c6eeaf10f98ee84c36 Mon Sep 17 00:00:00 2001 From: Justin Rebelo <4203789+jrebs@users.noreply.github.com> Date: Mon, 15 Jul 2019 11:54:11 -0700 Subject: [PATCH 1/3] Allow hourlyAt() to accept array of integers --- src/Illuminate/Console/Scheduling/ManagesFrequencies.php | 6 ++++-- tests/Console/Scheduling/FrequencyTest.php | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index 1f1144131cda..11006b9d203b 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -122,13 +122,15 @@ public function hourly() } /** - * Schedule the event to run hourly at a given offset in the hour. + * Schedule the event to run hourly at a given offset in the hour. The + * offset can be either an integer or an array of integers. * - * @param int $offset + * @param int|array $offset * @return $this */ public function hourlyAt($offset) { + $offset = is_array($offset) ? implode(',', $offset) : $offset; return $this->spliceIntoPosition(1, $offset); } diff --git a/tests/Console/Scheduling/FrequencyTest.php b/tests/Console/Scheduling/FrequencyTest.php index 3602c9141db8..179a68c84e21 100644 --- a/tests/Console/Scheduling/FrequencyTest.php +++ b/tests/Console/Scheduling/FrequencyTest.php @@ -47,6 +47,7 @@ public function testOverrideWithHourly() { $this->assertEquals('0 * * * *', $this->event->everyFiveMinutes()->hourly()->getExpression()); $this->assertEquals('37 * * * *', $this->event->hourlyAt(37)->getExpression()); + $this->assertEquals('15,30,45 * * * *', $this->event->hourlyAt([15,30,45])->getExpression()); } public function testMonthlyOn() From a2016c340f0620bbf2938951ad40005e64be3a37 Mon Sep 17 00:00:00 2001 From: Justin Rebelo <4203789+jrebs@users.noreply.github.com> Date: Mon, 15 Jul 2019 12:03:48 -0700 Subject: [PATCH 2/3] Style fixes --- src/Illuminate/Console/Scheduling/ManagesFrequencies.php | 1 + tests/Console/Scheduling/FrequencyTest.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index 11006b9d203b..21be9cf49f17 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -131,6 +131,7 @@ public function hourly() public function hourlyAt($offset) { $offset = is_array($offset) ? implode(',', $offset) : $offset; + return $this->spliceIntoPosition(1, $offset); } diff --git a/tests/Console/Scheduling/FrequencyTest.php b/tests/Console/Scheduling/FrequencyTest.php index 179a68c84e21..dd32b3555141 100644 --- a/tests/Console/Scheduling/FrequencyTest.php +++ b/tests/Console/Scheduling/FrequencyTest.php @@ -47,7 +47,7 @@ public function testOverrideWithHourly() { $this->assertEquals('0 * * * *', $this->event->everyFiveMinutes()->hourly()->getExpression()); $this->assertEquals('37 * * * *', $this->event->hourlyAt(37)->getExpression()); - $this->assertEquals('15,30,45 * * * *', $this->event->hourlyAt([15,30,45])->getExpression()); + $this->assertEquals('15,30,45 * * * *', $this->event->hourlyAt([15, 30, 45])->getExpression()); } public function testMonthlyOn() From 084546d311ead61cb4e60b2b6aefa01188df46ac Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 15 Jul 2019 15:54:32 -0500 Subject: [PATCH 3/3] Update ManagesFrequencies.php --- src/Illuminate/Console/Scheduling/ManagesFrequencies.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index 21be9cf49f17..ced7e754a5b2 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -122,10 +122,9 @@ public function hourly() } /** - * Schedule the event to run hourly at a given offset in the hour. The - * offset can be either an integer or an array of integers. + * Schedule the event to run hourly at a given offset in the hour. * - * @param int|array $offset + * @param array|int $offset * @return $this */ public function hourlyAt($offset)