From bb4cb32d3941c0df898998b526866e7e6e3e5f13 Mon Sep 17 00:00:00 2001 From: darkalchemy Date: Tue, 30 Jun 2020 12:56:34 -0400 Subject: [PATCH 1/2] replace: "mtdowling/cron-expression" with "dragonmantank/cron-expression" --- README.md | 2 +- composer.json | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 101c979..433d696 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Jobby can handle logging, locking, error emails and more. - Maintain one master crontab job. - Jobs run via PHP, so you can run them under any programmatic conditions. -- Use ordinary crontab schedule syntax (powered by the excellent [`cron-expression`]()). +- Use ordinary crontab schedule syntax (powered by the excellent [`cron-expression`]()). - Run only one copy of a job at a given time. - Send email whenever a job exits with an error status. - Run job as another user, if crontab user has `sudo` privileges. diff --git a/composer.json b/composer.json index 32ad6d7..5d96f38 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,9 @@ ], "require": { "php": ">=5.6", - "mtdowling/cron-expression": "^1.0", - "swiftmailer/swiftmailer": "^5.4|^6.0", + "dragonmantank/cron-expression": "^3.0", "jeremeamia/superclosure": "^2.2", + "swiftmailer/swiftmailer": "^5.4|^6.0", "symfony/process": "^2.7|^3.0|^4.0|^5.0" }, "require-dev": { @@ -34,5 +34,8 @@ "psr-4": { "Jobby\\Tests\\": "tests" } + }, + "config": { + "sort-packages": true } } From 4d8be2b5bdaa3d860a0940b7aa39ceae48a1b4a9 Mon Sep 17 00:00:00 2001 From: darkalchemy Date: Wed, 8 Jul 2020 19:45:44 -0400 Subject: [PATCH 2/2] add: test for non trivial cron expression that fails in current and passes now --- tests/ScheduleCheckerTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/ScheduleCheckerTest.php b/tests/ScheduleCheckerTest.php index 51ee575..032386f 100644 --- a/tests/ScheduleCheckerTest.php +++ b/tests/ScheduleCheckerTest.php @@ -58,6 +58,16 @@ public function test_it_can_detect_a_due_job_from_a_cron_expression() $this->assertTrue($this->scheduleChecker->isDue("* * * * *")); } + /** + * @return void + */ + public function test_it_can_detect_a_due_job_from_a_non_trivial_cron_expression() + { + $scheduleChecker = new ScheduleChecker(new DateTimeImmutable("2017-04-01 00:00:00")); + + $this->assertTrue($scheduleChecker->isDue("0 0 1 */3 *")); + } + /** * @return void */