You are here

public function DateTimeNormalizerTest::testSupportsNormalization in Drupal 9

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

@covers ::supportsNormalization

File

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

Class

DateTimeNormalizerTest
Unit test coverage for @DataTypes implementing DateTimeInterface.

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function testSupportsNormalization() {
  $this
    ->assertTrue($this->normalizer
    ->supportsNormalization($this->data
    ->reveal()));
  $datetimeiso8601 = $this
    ->prophesize(DateTimeIso8601::class);
  $this
    ->assertTrue($this->normalizer
    ->supportsNormalization($datetimeiso8601
    ->reveal()));
  $integer = $this
    ->prophesize(IntegerData::class);
  $this
    ->assertFalse($this->normalizer
    ->supportsNormalization($integer
    ->reveal()));
}