function NormalizerBaseTest::testSupportsNormalization

Same name in other branches
  1. 9 core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php \Drupal\Tests\serialization\Unit\Normalizer\NormalizerBaseTest::testSupportsNormalization()
  2. 8.9.x core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php \Drupal\Tests\serialization\Unit\Normalizer\NormalizerBaseTest::testSupportsNormalization()
  3. 10 core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php \Drupal\Tests\serialization\Unit\Normalizer\NormalizerBaseTest::testSupportsNormalization()

Tests the supportsNormalization method.

@dataProvider providerTestSupportsNormalization

Parameters

bool $expected_return: The expected boolean return value from supportNormalization.

mixed $data: The data passed to supportsNormalization.

string $supported_types: (optional) The supported interface or class to set on the normalizer.

File

core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php, line 28

Class

NormalizerBaseTest
@coversDefaultClass \Drupal\serialization\Normalizer\NormalizerBase @group serialization

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function testSupportsNormalization($expected_return, $data, $supported_types = NULL) : void {
    $normalizer_base = new TestNormalizerBase();
    if (isset($supported_types)) {
        $normalizer_base->setSupportedTypes($supported_types);
    }
    $this->assertSame($expected_return, $normalizer_base->supportsNormalization($data));
}

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