You are here

public function DateTimeIso8601NormalizerTest::testDenormalizeNoTargetInstanceOrFieldDefinitionException in Drupal 8

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

Tests the denormalize function with incomplete serialization context.

@covers ::denormalize

File

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

Class

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

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function testDenormalizeNoTargetInstanceOrFieldDefinitionException() {
  $this
    ->expectException(InvalidArgumentException::class);
  $this
    ->expectExceptionMessage('$context[\'target_instance\'] or $context[\'field_definition\'] must be set to denormalize with the DateTimeIso8601Normalizer');
  $this->normalizer
    ->denormalize('', DateTimeIso8601::class, NULL, []);
}