function ConfigEntityNormalizerTest::testNormalize
Same name in other branches
- 9 core/modules/serialization/tests/src/Unit/Normalizer/ConfigEntityNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\ConfigEntityNormalizerTest::testNormalize()
- 8.9.x core/modules/serialization/tests/src/Unit/Normalizer/ConfigEntityNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\ConfigEntityNormalizerTest::testNormalize()
- 10 core/modules/serialization/tests/src/Unit/Normalizer/ConfigEntityNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\ConfigEntityNormalizerTest::testNormalize()
Tests the normalize() method.
@covers ::normalize
File
-
core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ ConfigEntityNormalizerTest.php, line 26
Class
- ConfigEntityNormalizerTest
- @coversDefaultClass \Drupal\serialization\Normalizer\ConfigEntityNormalizer @group serialization
Namespace
Drupal\Tests\serialization\Unit\NormalizerCode
public function testNormalize() : void {
$test_export_properties = [
'test' => 'test',
'_core' => [
'default_config_hash' => $this->randomMachineName(),
$this->randomMachineName() => 'some random key',
],
];
$entity_field_manager = $this->createMock(EntityFieldManagerInterface::class);
$entity_type_manager = $this->createMock(EntityTypeManagerInterface::class);
$entity_type_repository = $this->createMock(EntityTypeRepositoryInterface::class);
$normalizer = new ConfigEntityNormalizer($entity_type_manager, $entity_type_repository, $entity_field_manager);
$config_entity = $this->createMock('Drupal\\Core\\Config\\Entity\\ConfigEntityInterface');
$config_entity->expects($this->once())
->method('toArray')
->willReturn($test_export_properties);
$this->assertSame([
'test' => 'test',
], $normalizer->normalize($config_entity));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.