protected function WebformMigrateAssertionsTrait::getImportantEntityProperties in Webform: Migrate 8
Same name and namespace in other branches
- 8.2 tests/src/Traits/WebformMigrateAssertionsTrait.php \Drupal\Tests\webform_migrate\Traits\WebformMigrateAssertionsTrait::getImportantEntityProperties()
Filters out unconcerned properties from an entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: An entity instance.
Return value
array The important entity property values as array.
13 calls to WebformMigrateAssertionsTrait::getImportantEntityProperties()
- WebformMigrateAssertionsTrait::assertWebform3Values in tests/
src/ Traits/ WebformMigrateAssertionsTrait.php - Assertions of the webform_3 configuration entity.
- WebformMigrateAssertionsTrait::assertWebform4Values in tests/
src/ Traits/ WebformMigrateAssertionsTrait.php - Assertions of the webform_4 configuration entity.
- WebformMigrateAssertionsTrait::assertWebform5Values in tests/
src/ Traits/ WebformMigrateAssertionsTrait.php - Assertions of the webform_5 configuration entity.
- WebformMigrateAssertionsTrait::assertWebformSubmission10Values in tests/
src/ Traits/ WebformMigrateAssertionsTrait.php - Assertions of the webform_submission 10 content entity.
- WebformMigrateAssertionsTrait::assertWebformSubmission1Values in tests/
src/ Traits/ WebformMigrateAssertionsTrait.php - Assertions of the webform_submission 1 content entity.
File
- tests/
src/ Traits/ WebformMigrateAssertionsTrait.php, line 822
Class
- WebformMigrateAssertionsTrait
- Trait for webform migration tests.
Namespace
Drupal\Tests\webform_migrate\TraitsCode
protected function getImportantEntityProperties(EntityInterface $entity) {
$entity_type_id = $entity
->getEntityTypeId();
$exploded = explode('_', $entity_type_id);
$prop_prefix = count($exploded) > 1 ? $exploded[0] . implode('', array_map('ucfirst', array_slice($exploded, 1))) : $entity_type_id;
$property_filter_preset_property = "{$prop_prefix}UnconcernedProperties";
$entity_array = $entity
->toArray();
$unconcerned_properties = property_exists(get_class($this), $property_filter_preset_property) ? $this->{$property_filter_preset_property} : [
'uuid',
'langcode',
'dependencies',
'_core',
];
foreach ($unconcerned_properties as $item) {
unset($entity_array[$item]);
}
return $entity_array;
}