function MapDataNormalizerTest::testMapNormalize

Same name in other branches
  1. 9 core/modules/serialization/tests/src/Kernel/MapDataNormalizerTest.php \Drupal\Tests\serialization\Kernel\MapDataNormalizerTest::testMapNormalize()
  2. 8.9.x core/modules/serialization/tests/src/Kernel/MapDataNormalizerTest.php \Drupal\Tests\serialization\Kernel\MapDataNormalizerTest::testMapNormalize()
  3. 11.x core/modules/serialization/tests/src/Kernel/MapDataNormalizerTest.php \Drupal\Tests\serialization\Kernel\MapDataNormalizerTest::testMapNormalize()

Tests whether map data can be normalized.

File

core/modules/serialization/tests/src/Kernel/MapDataNormalizerTest.php, line 47

Class

MapDataNormalizerTest
@group TypedData

Namespace

Drupal\Tests\serialization\Kernel

Code

public function testMapNormalize() : void {
    $typed_data = $this->buildExampleTypedData();
    $data = $this->serializer
        ->normalize($typed_data, 'json');
    $expect_value = [
        'key1' => 'value1',
        'key2' => 'value2',
        'key3' => 3,
        'key4' => [
            0 => TRUE,
            1 => 'value6',
            'key7' => 'value7',
        ],
    ];
    $this->assertSame($expect_value, $data);
}

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