Unverified Commit c14dad7a authored by jibran's avatar jibran Committed by larowlan

Issue #3038668 by jibran, andypost, Berdir, amateescu: Fix tests following a...

Issue #3038668 by jibran, andypost, Berdir, amateescu: Fix tests following a change in Drupal 8.7.0: #2976035
parent 7462abb3
......@@ -5,6 +5,7 @@
* Contains install and update hooks.
*/
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
use Drupal\Core\Url;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Config\FileStorage;
......@@ -14,17 +15,20 @@ use Drupal\Core\Field\BaseFieldDefinition;
* Implements hook_install().
*/
function contact_storage_install() {
$entity_manager = \Drupal::entityTypeManager();
$entity_type = $entity_manager->getDefinition('contact_message');
$entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
$original_contact_message = $entity_definition_update_manager->getEntityType('contact_message');
$original_contact_form = \Drupal::entityTypeManager()->getDefinition('contact_form');
$entity_type_contact_message = clone $original_contact_message;
$entity_definition_update_manager->uninstallEntityType($original_contact_message);
// Recreate the original entity type definition, in order to notify the
// manager of what changed. The change of storage backend will trigger
// schema installation.
// @see contact_storage_test_entity_type_alter()
$original = clone $entity_type;
$original->setStorageClass('Drupal\Core\Entity\ContentEntityNullStorage');
\Drupal::service('entity_type.listener')
->onEntityTypeUpdate($entity_type, $original);
// Update the entity type definition and make it use the default SQL storage.
// @see contact_storage_entity_type_alter()
$entity_types = [
'contact_message' => $entity_type_contact_message,
'contact_form' => $original_contact_form,
];
contact_storage_entity_type_alter($entity_types);
$entity_definition_update_manager->installEntityType($entity_types['contact_message']);
_contact_storage_ensure_fields();
}
......
......@@ -38,7 +38,6 @@ class ContactStorageTest extends ContactStorageTestBase {
'contact',
'language',
'field_ui',
'contact_storage_test',
'contact_test',
'contact_storage',
'filter',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment