You are here

public function DateTimeIso8601NormalizerTest::providerTestDenormalizeValidFormats in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\DateTimeIso8601NormalizerTest::providerTestDenormalizeValidFormats()
  2. 9 core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\DateTimeIso8601NormalizerTest::providerTestDenormalizeValidFormats()

Data provider for testDenormalizeValidFormats.

Return value

array

File

core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php, line 198

Class

DateTimeIso8601NormalizerTest
Unit test coverage for the "datetime_iso8601" @DataType.

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function providerTestDenormalizeValidFormats() {
  $data = [];
  $data['just a date'] = [
    'date-only',
    '2016-11-06',
    '2016-11-06',
  ];
  $data['RFC3339'] = [
    'date+time',
    '2016-11-06T09:02:00+00:00',
    '2016-11-06T09:02:00',
  ];
  $data['RFC3339 +0100'] = [
    'date+time',
    '2016-11-06T09:02:00+01:00',
    '2016-11-06T08:02:00',
  ];
  $data['RFC3339 -0600'] = [
    'date+time',
    '2016-11-06T09:02:00-06:00',
    '2016-11-06T15:02:00',
  ];
  $data['ISO8601'] = [
    'date+time',
    '2016-11-06T09:02:00+0000',
    '2016-11-06T09:02:00',
  ];
  $data['ISO8601 +0100'] = [
    'date+time',
    '2016-11-06T09:02:00+0100',
    '2016-11-06T08:02:00',
  ];
  $data['ISO8601 -0600'] = [
    'date+time',
    '2016-11-06T09:02:00-0600',
    '2016-11-06T15:02:00',
  ];
  return $data;
}