function ComplexDataNormalizerTest::testSupportsNormalization

Same name in other branches
  1. 9 core/modules/serialization/tests/src/Unit/Normalizer/ComplexDataNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\ComplexDataNormalizerTest::testSupportsNormalization()
  2. 8.9.x core/modules/serialization/tests/src/Unit/Normalizer/ComplexDataNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\ComplexDataNormalizerTest::testSupportsNormalization()
  3. 11.x 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 46

Class

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

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function testSupportsNormalization() : void {
    $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()));
}

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