function NormalizerBaseTest::testSupportsNormalization

Same name in other branches
  1. 8.9.x core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php \Drupal\Tests\serialization\Unit\Normalizer\NormalizerBaseTest::testSupportsNormalization()
  2. 10 core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php \Drupal\Tests\serialization\Unit\Normalizer\NormalizerBaseTest::testSupportsNormalization()
  3. 11.x 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_interface_or_class: (optional) The supported interface or class to set on the normalizer.

File

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

Class

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

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function testSupportsNormalization($expected_return, $data, $supported_interface_or_class = NULL) {
    $normalizer_base = $this->getMockForAbstractClass('Drupal\\Tests\\serialization\\Unit\\Normalizer\\TestNormalizerBase');
    if (isset($supported_interface_or_class)) {
        $normalizer_base->setSupportedInterfaceOrClass($supported_interface_or_class);
    }
    $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.