function ComplexDataNormalizerTest::testSupportsNormalization

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

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()));
}

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