Skip to content

Commit

Permalink
Merge pull request #128 from darkalchemy/replace-cron-expression
Browse files Browse the repository at this point in the history
Replace cron-expression
  • Loading branch information
darkalchemy committed Jul 17, 2020
2 parents d2756b6 + 4d8be2b commit e57e905
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`](<https://github.com/mtdowling/cron-expression>)).
- Use ordinary crontab schedule syntax (powered by the excellent [`cron-expression`](<https://github.com/dragonmantank/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.
Expand Down
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -34,5 +34,8 @@
"psr-4": {
"Jobby\\Tests\\": "tests"
}
},
"config": {
"sort-packages": true
}
}
10 changes: 10 additions & 0 deletions tests/ScheduleCheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit e57e905

Please sign in to comment.