You are here

public function ComplexDataNormalizerTest::testNormalize in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/serialization/tests/src/Unit/Normalizer/ComplexDataNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\ComplexDataNormalizerTest::testNormalize()

@covers ::normalize

File

core/modules/serialization/tests/src/Unit/Normalizer/ComplexDataNormalizerTest.php, line 55
Contains \Drupal\Tests\serialization\Unit\Normalizer\ComplexDataNormalizerTest.

Class

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

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function testNormalize() {
  $context = [
    'test' => 'test',
  ];
  $serializer_prophecy = $this
    ->prophesize(Serializer::class);
  $serializer_prophecy
    ->normalize('A', static::TEST_FORMAT, $context)
    ->shouldBeCalled();
  $serializer_prophecy
    ->normalize('B', static::TEST_FORMAT, $context)
    ->shouldBeCalled();
  $this->normalizer
    ->setSerializer($serializer_prophecy
    ->reveal());
  $complex_data = new TestComplexData([
    'a' => 'A',
    'b' => 'B',
  ]);
  $this->normalizer
    ->normalize($complex_data, static::TEST_FORMAT, $context);
}