Skip to content

Commit e57e905

Browse files
authored
Merge pull request #128 from darkalchemy/replace-cron-expression
Replace cron-expression
2 parents d2756b6 + 4d8be2b commit e57e905

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Jobby can handle logging, locking, error emails and more.
1313

1414
- Maintain one master crontab job.
1515
- Jobs run via PHP, so you can run them under any programmatic conditions.
16-
- Use ordinary crontab schedule syntax (powered by the excellent [`cron-expression`](<https://github.com/mtdowling/cron-expression>)).
16+
- Use ordinary crontab schedule syntax (powered by the excellent [`cron-expression`](<https://github.com/dragonmantank/cron-expression>)).
1717
- Run only one copy of a job at a given time.
1818
- Send email whenever a job exits with an error status.
1919
- Run job as another user, if crontab user has `sudo` privileges.

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
],
1717
"require": {
1818
"php": ">=5.6",
19-
"mtdowling/cron-expression": "^1.0",
20-
"swiftmailer/swiftmailer": "^5.4|^6.0",
19+
"dragonmantank/cron-expression": "^3.0",
2120
"jeremeamia/superclosure": "^2.2",
21+
"swiftmailer/swiftmailer": "^5.4|^6.0",
2222
"symfony/process": "^2.7|^3.0|^4.0|^5.0"
2323
},
2424
"require-dev": {
@@ -34,5 +34,8 @@
3434
"psr-4": {
3535
"Jobby\\Tests\\": "tests"
3636
}
37+
},
38+
"config": {
39+
"sort-packages": true
3740
}
3841
}

tests/ScheduleCheckerTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ public function test_it_can_detect_a_due_job_from_a_cron_expression()
5858
$this->assertTrue($this->scheduleChecker->isDue("* * * * *"));
5959
}
6060

61+
/**
62+
* @return void
63+
*/
64+
public function test_it_can_detect_a_due_job_from_a_non_trivial_cron_expression()
65+
{
66+
$scheduleChecker = new ScheduleChecker(new DateTimeImmutable("2017-04-01 00:00:00"));
67+
68+
$this->assertTrue($scheduleChecker->isDue("0 0 1 */3 *"));
69+
}
70+
6171
/**
6272
* @return void
6373
*/

0 commit comments

Comments
 (0)