You are here

public function DateTimeIso8601NormalizerTest::testDenormalizeDateAndTimeDeprecatedFormat in Drupal 8

Tests the denormalize function with the date+time deprecated format.

@covers ::denormalize @group legacy @expectedDeprecation The provided datetime string format (Y-m-d\TH:i:s) is deprecated and will be removed before Drupal 9.0.0. Use the RFC3339 format instead (Y-m-d\TH:i:sP).

File

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

Class

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

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function testDenormalizeDateAndTimeDeprecatedFormat() {
  $normalized = '2016-11-06T08:00:00';
  $field_definition = $this
    ->prophesize(FieldDefinitionInterface::class);
  $field_definition
    ->getSetting('datetime_type')
    ->willReturn(DateTimeItem::DATETIME_TYPE_DATETIME);
  $this->normalizer
    ->denormalize($normalized, DateTimeIso8601::class, NULL, [
    'field_definition' => $field_definition
      ->reveal(),
  ]);
}