protected function DateTimeFieldTest::datelistDataProvider in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/datetime/src/Tests/DateTimeFieldTest.php \Drupal\datetime\Tests\DateTimeFieldTest::datelistDataProvider()
The data provider for testing the validation of the datelist widget.
Return value
array An array of datelist input permutations to test.
1 call to DateTimeFieldTest::datelistDataProvider()
- DateTimeFieldTest::testDatelistWidget in core/
modules/ datetime/ src/ Tests/ DateTimeFieldTest.php - Tests Date List Widget functionality.
File
- core/
modules/ datetime/ src/ Tests/ DateTimeFieldTest.php, line 591 - Contains \Drupal\datetime\Tests\DateTimeFieldTest.
Class
- DateTimeFieldTest
- Tests Datetime field functionality.
Namespace
Drupal\datetime\TestsCode
protected function datelistDataProvider() {
return [
// Year only selected, validation error on Month, Day, Hour, Minute.
[
[
'year' => 2012,
'month' => '',
'day' => '',
'hour' => '',
'minute' => '',
],
[
'A value must be selected for month.',
'A value must be selected for day.',
'A value must be selected for hour.',
'A value must be selected for minute.',
],
],
// Year and Month selected, validation error on Day, Hour, Minute.
[
[
'year' => 2012,
'month' => '12',
'day' => '',
'hour' => '',
'minute' => '',
],
[
'A value must be selected for day.',
'A value must be selected for hour.',
'A value must be selected for minute.',
],
],
// Year, Month and Day selected, validation error on Hour, Minute.
[
[
'year' => 2012,
'month' => '12',
'day' => '31',
'hour' => '',
'minute' => '',
],
[
'A value must be selected for hour.',
'A value must be selected for minute.',
],
],
// Year, Month, Day and Hour selected, validation error on Minute only.
[
[
'year' => 2012,
'month' => '12',
'day' => '31',
'hour' => '0',
'minute' => '',
],
[
'A value must be selected for minute.',
],
],
];
}