You are here

public function NormalizerBaseTest::testSupportsNormalization in Drupal 8

Same name and namespace in other branches
  1. 9 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
Contains \Drupal\Tests\serialization\Unit\Normalizer\NormalizerBaseTest.

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