function DateTimeIso8601NormalizerTest::testDenormalizeDateAndTimeDeprecatedFormat

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(),
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.