function MapDataNormalizerTest::buildExampleTypedDataWithProperties
Same name in other branches
- 9 core/modules/serialization/tests/src/Kernel/MapDataNormalizerTest.php \Drupal\Tests\serialization\Kernel\MapDataNormalizerTest::buildExampleTypedDataWithProperties()
- 10 core/modules/serialization/tests/src/Kernel/MapDataNormalizerTest.php \Drupal\Tests\serialization\Kernel\MapDataNormalizerTest::buildExampleTypedDataWithProperties()
- 11.x core/modules/serialization/tests/src/Kernel/MapDataNormalizerTest.php \Drupal\Tests\serialization\Kernel\MapDataNormalizerTest::buildExampleTypedDataWithProperties()
Builds some example typed data object with properties.
1 call to MapDataNormalizerTest::buildExampleTypedDataWithProperties()
- MapDataNormalizerTest::testMapWithPropertiesNormalize in core/
modules/ serialization/ tests/ src/ Kernel/ MapDataNormalizerTest.php - Test whether map data with properties can be normalized.
File
-
core/
modules/ serialization/ tests/ src/ Kernel/ MapDataNormalizerTest.php, line 106
Class
- MapDataNormalizerTest
- @group typedData
Namespace
Drupal\Tests\serialization\KernelCode
protected function buildExampleTypedDataWithProperties() {
$tree = [
'key1' => 'value1',
'key2' => 'value2',
'key3' => 3,
'key4' => [
0 => TRUE,
1 => 'value6',
'key7' => 'value7',
],
];
$map_data_definition = MapDataDefinition::create()->setPropertyDefinition('key1', DataDefinition::create('string'))
->setPropertyDefinition('key2', DataDefinition::create('string'))
->setPropertyDefinition('key3', DataDefinition::create('integer'))
->setPropertyDefinition('key4', MapDataDefinition::create()->setPropertyDefinition(0, DataDefinition::create('boolean'))
->setPropertyDefinition(1, DataDefinition::create('string'))
->setPropertyDefinition('key7', DataDefinition::create('string')));
$typed_data = $this->typedDataManager
->create($map_data_definition, $tree, 'test name');
return $typed_data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.