public function DateTimePlusTest::providerTestInvalidDates in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::providerTestInvalidDates()
Provides data for testInvalidDates.
Return value
array An array of arrays, each containing:
- 'input' - Input for DateTimePlus.
- 'timezone' - Timezone for DateTimePlus.
- 'format' - Format for DateTimePlus.
- 'message' - Message to display on failure.
See also
testInvalidDates
File
- core/
tests/ Drupal/ Tests/ Component/ Datetime/ DateTimePlusTest.php, line 418
Class
- DateTimePlusTest
- @coversDefaultClass \Drupal\Component\Datetime\DateTimePlus @group Datetime
Namespace
Drupal\Tests\Component\DatetimeCode
public function providerTestInvalidDates() {
return [
// Test for invalid month names when we are using a short version
// of the month.
[
'23 abc 2012',
NULL,
'd M Y',
"23 abc 2012 contains an invalid month name and did not produce errors.",
\InvalidArgumentException::class,
],
// Test for invalid hour.
[
'0000-00-00T45:30:00',
NULL,
'Y-m-d\\TH:i:s',
"0000-00-00T45:30:00 contains an invalid hour and did not produce errors.",
\UnexpectedValueException::class,
],
// Test for invalid day.
[
'0000-00-99T05:30:00',
NULL,
'Y-m-d\\TH:i:s',
"0000-00-99T05:30:00 contains an invalid day and did not produce errors.",
\UnexpectedValueException::class,
],
// Test for invalid month.
[
'0000-75-00T15:30:00',
NULL,
'Y-m-d\\TH:i:s',
"0000-75-00T15:30:00 contains an invalid month and did not produce errors.",
\UnexpectedValueException::class,
],
// Test for invalid year.
[
'11-08-01T15:30:00',
NULL,
'Y-m-d\\TH:i:s',
"11-08-01T15:30:00 contains an invalid year and did not produce errors.",
\UnexpectedValueException::class,
],
];
}