You are here

public function DateTimeNormalizerTest::providerTestDenormalizeUserFormats in Drupal 8

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

Data provider for testDenormalizeUserFormats.

Return value

array

File

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

Class

DateTimeNormalizerTest
Unit test coverage for @DataTypes implementing DateTimeInterface.

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function providerTestDenormalizeUserFormats() {
  $data = [];
  $data['Y/m/d H:i:s P'] = [
    '2016/11/06 09:02:00 +00:00',
    'Y/m/d H:i:s P',
    new \DateTimeImmutable('2016-11-06T09:02:00+00:00'),
  ];
  $data['H:i:s Y/m/d P'] = [
    '09:02:00 2016/11/06  +01:00',
    'H:i:s Y/m/d P',
    new \DateTimeImmutable('2016-11-06T09:02:00+01:00'),
  ];
  $data['Y/m/d H:i:s'] = [
    '09:02:00 2016/11/06',
    'H:i:s Y/m/d',
    new \DateTimeImmutable('2016-11-06T09:02:00+11:00'),
  ];
  return $data;
}