diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php index bf30b56..8a96ab2 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -621,12 +621,12 @@ public function install(array $module_list, $enable_dependencies = TRUE) { // Allow modules to react prior to the installation of a module. $this->invokeAll('module_preinstall', array($module)); - // Clear plugin manager caches. - \Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions(); - // Now install the module's schema if necessary. drupal_install_schema($module); + // Clear plugin manager caches. + \Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions(); + // Set the schema version to the number of the last update provided by // the module, or the minimum core schema version. $version = \Drupal::CORE_MINIMUM_SCHEMA_VERSION; diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php index 10c8f80..21b637d 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php @@ -6,6 +6,7 @@ */ namespace Drupal\comment\Tests; +use Drupal\field\Field; /** * Tests fields on comments. @@ -78,6 +79,8 @@ function testCommentInstallAfterContentModule() { $field->delete(); } + Field::fieldInfo()->getField('comment', 'comment_body')->delete(); + // Purge field data now to allow comment module to be uninstalled once the // field has been deleted. field_purge_batch(10); diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php index 32ffe10..5a1de81 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php @@ -173,31 +173,30 @@ function testInstancePrepare() { * Test that instances on disabled entity types are filtered out. */ function testInstanceDisabledEntityType() { - // Disabling the comment module invokes user_modules_uninstalled() and calls + // Disabling a module invokes user_modules_uninstalled() and calls // drupal_flush_all_caches(). Install the necessary schema to support this. $this->installSchema('user', array('users_data')); $this->installSchema('system', array('router')); // For this test the field type and the entity type must be exposed by // different modules. - $this->enableModules(array('node', 'comment')); $field_definition = array( 'name' => 'field', - 'entity_type' => 'comment', + 'entity_type' => 'entity_test', 'type' => 'test_field', ); entity_create('field_config', $field_definition)->save(); $instance_definition = array( 'field_name' => 'field', - 'entity_type' => 'comment', - 'bundle' => 'comment_node_article', + 'entity_type' => 'entity_test', + 'bundle' => 'entity_test', ); entity_create('field_instance_config', $instance_definition)->save(); - $this->assertNotNull(field_info_instance('comment', 'field', 'comment_node_article'), 'Instance is returned on enabled entity types.'); + $this->assertNotNull(field_info_instance('entity_test', 'field', 'entity_test'), 'Instance is returned on enabled entity types.'); // Disable comment module. This clears field_info cache. - module_uninstall(array('comment')); - $this->assertNull(field_info_instance('comment', 'field', 'comment_node_article'), 'No instances are returned on disabled entity types.'); + module_uninstall(array('entity_test')); + $this->assertNull(field_info_instance('entity_test', 'field', 'entity_test'), 'No instances are returned on disabled entity types.'); } /**