diff -u b/core/modules/forum/src/Tests/ForumUninstallTest.php b/core/modules/forum/src/Tests/ForumUninstallTest.php --- b/core/modules/forum/src/Tests/ForumUninstallTest.php +++ b/core/modules/forum/src/Tests/ForumUninstallTest.php @@ -140,7 +140,7 @@ $field_storage = FieldStorageConfig::loadByName('node', 'taxonomy_forums'); $this->assertNull($field_storage, 'The taxonomy_forums field storage has been deleted.'); - // Delete all terms in the Forums vocabulary. Uninstalling the form module + // Delete all terms in the Forums vocabulary. Uninstalling the forum module // will fail unless this is done. $terms = entity_load_multiple_by_properties('taxonomy_term', array('vid' => 'forums')); foreach($terms as $term) { only in patch2: unchanged: --- a/core/modules/comment/src/Tests/CommentUninstallTest.php +++ b/core/modules/comment/src/Tests/CommentUninstallTest.php @@ -8,6 +8,7 @@ namespace Drupal\comment\Tests; use Drupal\field\Entity\FieldStorageConfig; +use Drupal\Core\Extension\ModuleUninstallValidatorException; use Drupal\simpletest\WebTestBase; /** @@ -36,19 +37,22 @@ protected function setUp() { } /** - * Tests if comment module uninstallation properly deletes the field. + * Tests if comment module uninstallation fails if the field exists. + * + * @throws \Drupal\Core\Extension\ModuleUninstallValidatorException */ function testCommentUninstallWithField() { // Ensure that the field exists before uninstallation. $field_storage = FieldStorageConfig::loadByName('comment', 'comment_body'); $this->assertNotNull($field_storage, 'The comment_body field exists.'); - // Uninstall the comment module which should trigger field deletion. - $this->container->get('module_installer')->uninstall(array('comment')); - - // Check that the field is now deleted. - $field_storage = FieldStorageConfig::loadByName('comment', 'comment_body'); - $this->assertNull($field_storage, 'The comment_body field has been deleted.'); + // Uninstall the comment module which should trigger an exception. + try { + $this->container->get('module_installer')->uninstall(array('comment')); + $this->fail("Expected an exception when uninstall was attempted."); + } catch (ModuleUninstallValidatorException $e) { + $this->pass("Caught an exception when uninstall was attempted."); + } }