Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 0b972e8

Browse files
committed
chore: added improved datetime tests
1 parent 386b48c commit 0b972e8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/DateTimeTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,20 @@ public static function provideRuleUnexpectedValueData(): \Generator
2525

2626
public static function provideRuleFailureConditionData(): \Generator
2727
{
28-
$value = 'invalid';
2928
$exception = DateTimeException::class;
3029
$message = '/The (.*) value is not a valid datetime./';
3130

32-
yield 'invalid datetime' => [new DateTime(), $value, $exception, $message];
3331
yield 'invalid format' => [new DateTime(format: 'invalid'), '2024-01-01 00:00:00', $exception, $message];
32+
yield 'invalid datetime' => [new DateTime(), '2024-01-01', $exception, $message];
33+
yield 'invalid overflow date' => [new DateTime(format: 'Y-m-d'), '2024-01-35', $exception, $message];
34+
yield 'invalid overflow time' => [new DateTime(format: 'H:i:s'), '35:00:00', $exception, $message];
3435
}
3536

3637
public static function provideRuleSuccessConditionData(): \Generator
3738
{
3839
yield 'datetime' => [new DateTime(), '2024-01-01 00:00:00'];
39-
yield 'format' => [new DateTime(format: 'Y-m-d'), '2024-01-01'];
40+
yield 'date' => [new DateTime(format: 'Y-m-d'), '2024-01-01'];
41+
yield 'time' => [new DateTime(format: 'H:i:s'), '21:00:00'];
4042
}
4143

4244
public static function provideRuleMessageOptionData(): \Generator

0 commit comments

Comments
 (0)