You are here

public function DateTimeNormalizerTest::providerTestDenormalizeValidFormats in Drupal 10

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

Data provider for testDenormalizeValidFormats.

Return value

array

File

core/modules/serialization/tests/src/Unit/Normalizer/DateTimeNormalizerTest.php, line 122

Class

DateTimeNormalizerTest
Unit test coverage for @DataTypes implementing DateTimeInterface.

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function providerTestDenormalizeValidFormats() {
  $data = [];
  $data['RFC3339'] = [
    '2016-11-06T09:02:00+00:00',
    new \DateTimeImmutable('2016-11-06T09:02:00+00:00'),
  ];
  $data['RFC3339 +0100'] = [
    '2016-11-06T09:02:00+01:00',
    new \DateTimeImmutable('2016-11-06T09:02:00+01:00'),
  ];
  $data['RFC3339 -0600'] = [
    '2016-11-06T09:02:00-06:00',
    new \DateTimeImmutable('2016-11-06T09:02:00-06:00'),
  ];
  $data['ISO8601'] = [
    '2016-11-06T09:02:00+0000',
    new \DateTimeImmutable('2016-11-06T09:02:00+00:00'),
  ];
  $data['ISO8601 +0100'] = [
    '2016-11-06T09:02:00+0100',
    new \DateTimeImmutable('2016-11-06T09:02:00+01:00'),
  ];
  $data['ISO8601 -0600'] = [
    '2016-11-06T09:02:00-0600',
    new \DateTimeImmutable('2016-11-06T09:02:00-06:00'),
  ];
  return $data;
}