function ListNormalizerTest::testNormalize

Tests the normalize() method.

File

core/modules/serialization/tests/src/Unit/Normalizer/ListNormalizerTest.php, line 93

Class

ListNormalizerTest
Tests Drupal\serialization\Normalizer\ListNormalizer.

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function testNormalize() : void {
  $serializer = $this->prophesize(Serializer::class);
  $serializer->normalize($this->typedData, 'json', [
    'mu' => 'nu',
  ])
    ->shouldBeCalledTimes(3)
    ->willReturn('test');
  $this->normalizer
    ->setSerializer($serializer->reveal());
  $normalized = $this->normalizer
    ->normalize($this->list, 'json', [
    'mu' => 'nu',
  ]);
  $this->assertEquals($this->expectedListValues, $normalized);
}

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