Skip to content

Commit 9f25304

Browse files
committed
test: test more edge cases
1 parent cd33be0 commit 9f25304

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/ExpressionTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ class ExpressionTest extends \PHPUnit_Framework_TestCase
99
/**
1010
* @dataProvider scheduleProvider
1111
*/
12-
public function test_isDue($expr, $time, $foo, $expected)
12+
public function test_isDue($expr, $time, $foo, $expected, $throwsAt = false)
1313
{
14+
if ($throwsAt) {
15+
$this->setExpectedException(
16+
\UnexpectedValueException::class,
17+
"Invalid offset value at segment #$throwsAt"
18+
);
19+
}
20+
1421
$actual = Expression::isDue($expr, $time);
1522

1623
$this->assertSame($expected, $actual, 'The expression ' . $expr . ' has failed');
@@ -117,6 +124,8 @@ public function scheduleProvider()
117124
['* * * * 5#2', strtotime('2011-07-01 00:00:00'), '2011-07-08 00:00:00', false],
118125
['* * * * 5#1', strtotime('2011-07-01 00:00:00'), '2011-07-01 00:00:00', true],
119126
['* * * * 3#4', strtotime('2011-07-01 00:00:00'), '2011-07-27 00:00:00', false],
127+
['* * * * 4W', strtotime('2011-07-01 00:00:00'), '2011-07-27 00:00:00', false, 4], # seg 4
128+
['* * * 1L *', strtotime('2011-07-01 00:00:00'), '2011-07-27 00:00:00', false, 3], # seg 3
120129
];
121130
}
122131
}

0 commit comments

Comments
 (0)