You are here

public function TimestampItemNormalizerTest::testSupportsDenormalization in Drupal 10

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

@covers ::supportsDenormalization

File

core/modules/serialization/tests/src/Unit/Normalizer/TimestampItemNormalizerTest.php, line 61

Class

TimestampItemNormalizerTest
Tests that TimestampItem (de)normalization uses Timestamp (de)normalization.

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function testSupportsDenormalization() {
  $timestamp_item = $this
    ->createTimestampItemProphecy();
  $this
    ->assertTrue($this->normalizer
    ->supportsDenormalization($timestamp_item
    ->reveal(), TimestampItem::class));

  // CreatedItem extends regular TimestampItem.
  $timestamp_item = $this
    ->prophesize(CreatedItem::class);
  $this
    ->assertTrue($this->normalizer
    ->supportsDenormalization($timestamp_item
    ->reveal(), TimestampItem::class));
  $entity_ref_item = $this
    ->prophesize(EntityReferenceItem::class);
  $this
    ->assertFalse($this->normalizer
    ->supportsNormalization($entity_ref_item
    ->reveal(), TimestampItem::class));
}