You are here

public function DateTimeItemTest::dateonlyValidationProvider in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php \Drupal\Tests\datetime\Kernel\DateTimeItemTest::dateonlyValidationProvider()
  2. 10 core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php \Drupal\Tests\datetime\Kernel\DateTimeItemTest::dateonlyValidationProvider()

Provider for testDatetimeValidation().

File

core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php, line 332

Class

DateTimeItemTest
Tests the new entity API for the date field type.

Namespace

Drupal\Tests\datetime\Kernel

Code

public 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',
      ],
    ],
  ];
}