You are here

public function ComplexDataNormalizerTest::testSupportsNormalization in Drupal 9

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

@covers ::supportsNormalization

File

core/modules/serialization/tests/src/Unit/Normalizer/ComplexDataNormalizerTest.php, line 47
Contains \Drupal\Tests\serialization\Unit\Normalizer\ComplexDataNormalizerTest.

Class

ComplexDataNormalizerTest
@coversDefaultClass \Drupal\serialization\Normalizer\ComplexDataNormalizer @group serialization

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function testSupportsNormalization() {
  $complex_data = $this
    ->prophesize(ComplexDataInterface::class)
    ->reveal();
  $this
    ->assertTrue($this->normalizer
    ->supportsNormalization($complex_data));

  // Also test that an object not implementing ComplexDataInterface fails.
  $this
    ->assertFalse($this->normalizer
    ->supportsNormalization(new \stdClass()));
}