function DateTimeItemTest::dateOnlyValidationProvider
Provider for testDatetimeValidation().
File
- 
              core/
modules/ datetime/ tests/ src/ Kernel/ DateTimeItemTest.php, line 336  
Class
- DateTimeItemTest
 - Tests the new entity API for the date field type.
 
Namespace
Drupal\Tests\datetime\KernelCode
public static function dateOnlyValidationProvider() {
  return [
    // Valid date strings, but unsupported by DateTimeItem.
[
      'Thu, 03 Nov 2014',
    ],
    [
      'Thursday, November 3, 2016',
    ],
    [
      'Thu, 11/03/2016',
    ],
    [
      '11/03/2016',
    ],
    // Invalid date strings.
[
      'YYYY-01-01',
    ],
    [
      '2014-MM-01',
    ],
    [
      '2014-01-DD',
    ],
    // Invalid dates.
[
      '2014-13-01',
    ],
    [
      '2014-01-55',
    ],
    // Proper format for different field setting.
[
      '2014-01-01T20:00:00',
    ],
    // Wrong input type.
[
      [
        '2014',
        '01',
        '01',
      ],
    ],
  ];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.