diff --git a/core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php b/core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php index 102f43c..e844ba1 100644 --- a/core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php +++ b/core/modules/system/src/Tests/Entity/EntityDefinitionTestTrait.php @@ -51,6 +51,7 @@ protected function updateEntityTypeToNotRevisionable() { $keys = $entity_type->getKeys(); unset($keys['revision']); $entity_type->set('entity_keys', $keys); + $entity_type->set('revision_table', NULL); $this->state->set('entity_test_update.entity_type', $entity_type); } @@ -88,6 +89,24 @@ protected function updateEntityTypeToNotTranslatable() { } /** + * Updates the 'entity_test_update' entity type to revisionable and + * translatable. + */ + protected function updateEntityTypeToRevisionableAndTranslatable() { + $entity_type = clone $this->entityManager->getDefinition('entity_test_update'); + + $keys = $entity_type->getKeys(); + $keys['revision'] = 'revision_id'; + $entity_type->set('entity_keys', $keys); + $entity_type->set('translatable', TRUE); + $entity_type->set('data_table', 'entity_test_update_data'); + $entity_type->set('revision_table', 'entity_test_update_revision'); + $entity_type->set('revision_data_table', 'entity_test_update_revision_data'); + + $this->state->set('entity_test_update.entity_type', $entity_type); + } + + /** * Adds a new base field to the 'entity_test_update' entity type. * * @param string $type diff --git a/core/modules/system/tests/modules/entity_test_update/entity_test_update.module b/core/modules/system/tests/modules/entity_test_update/entity_test_update.module index b54b630..f2447db 100644 --- a/core/modules/system/tests/modules/entity_test_update/entity_test_update.module +++ b/core/modules/system/tests/modules/entity_test_update/entity_test_update.module @@ -67,10 +67,12 @@ function entity_test_update_entity_presave(EntityInterface $entity) { * type. This was enabled after the first 50 entities were created in order * to have NULL values for its translation metadata fields * (e.g. content_translation_status); - * - 52 more test entities crated, translated and saved. + * - 52 more test entities (with the IDs 51 - 102) crated, translated and saved. * - * @param int $size - * The number of entities to create. + * @param int $start + * (optional) The entity ID to start from. Defaults to 1. + * @param int $end + * (optional) The entity ID to end with. Defaults to 50. * @param bool $add_translation * (optional) Whether to create a translation for each entity. If the number * of entities is greater than 50, the default translation (en) of the 51st @@ -80,9 +82,10 @@ function entity_test_update_entity_presave(EntityInterface $entity) { * @see drupal-8.0.0-rc1-filled.standard.entity_test_update.php.gz * @see drupal-8.0.0-rc1-filled.standard.entity_test_update_mul.php.gz */ -function _entity_test_update_create_test_entities($size = 50, $add_translation = FALSE) { - for ($i = 1; $i <= $size; $i++) { +function _entity_test_update_create_test_entities($start = 1, $end = 50, $add_translation = FALSE) { + for ($i = $start; $i <= $end; $i++) { $entity = EntityTestUpdate::create([ + 'id' => $i, 'name' => $i, 'test_single_property' => $i . ' - test single property', 'test_multiple_properties' => [[ @@ -155,10 +158,10 @@ function _entity_test_update_create_test_entities($size = 50, $add_translation = 'test_entity_base_field_info' => $i . ' - test entity base field info - ro', ]); - if ($i == 51) { + if ($i == 101) { $entity->getTranslation('en')->set('content_translation_status', FALSE); } - if ($i == 52) { + if ($i == 102) { $entity->getTranslation('ro')->set('content_translation_status', FALSE); } } diff --git a/core/modules/system/tests/modules/entity_test_update/src/Entity/EntityTestUpdate.php b/core/modules/system/tests/modules/entity_test_update/src/Entity/EntityTestUpdate.php index c6d9693..0de2460 100644 --- a/core/modules/system/tests/modules/entity_test_update/src/Entity/EntityTestUpdate.php +++ b/core/modules/system/tests/modules/entity_test_update/src/Entity/EntityTestUpdate.php @@ -29,7 +29,8 @@ * "bundle" = "type", * "label" = "name", * "langcode" = "langcode", - * } + * }, + * content_translation_ui_skip = TRUE, * ) */ class EntityTestUpdate extends ContentEntityBase {