diff --git a/core/modules/book/src/Tests/BookUninstallTest.php b/core/modules/book/src/Tests/BookUninstallTest.php index e69de29..d7c8fd6 100644 --- a/core/modules/book/src/Tests/BookUninstallTest.php +++ b/core/modules/book/src/Tests/BookUninstallTest.php @@ -0,0 +1,66 @@ +drupalCreateUser(array('create new books')); + $this->drupalLogin($user); + + // Add a new node of this type. + $node = $this->drupalCreateNode(array('type' => 'book')); + $this->verbose('Node of type book created.'); + $this->verbose('ID: ' . $node->id()); + + // uninstall the book module + \Drupal::moduleHandler()->uninstall(array('book')); + $this->verbose('Book module uninstalled.'); + + // ensure that the node type is gone and no new nodes of type book can be created + // call the link /node/add/book + // it shouldn't be available any more + $this->drupalGet('node/add/node'); + $this->assertResponse(404, 'The requested page "/node/add/book" could not be found.'); + + //entity_delete_multiple('node', array($node->id())); + + // check if the content we created of type book is deleted + $this->drupalGet('node/' . $node->id() . '/edit'); + $this->assertResponse(404, 'The requested page "/node/' . $node->id() . '/edit" could not be found.'); + + + //$node_after_reset = Node::load($node->id()); + //$this->verbose('ID: ' . $node_after_reset->id()); + + + + } + +} diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 4e3bc46..a446b9a 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1366,6 +1366,15 @@ function node_modules_installed($modules) { * Implements hook_modules_uninstalled(). */ function node_modules_uninstalled($modules) { + + // delete node type specific config settings + foreach ($modules as $module) { + // delete node type specific config settings + if ($config = \Drupal::config('node.type.' . $module)) { + $config->delete(); + } + } + // Remove module-specific settings from all node types. $config_names = \Drupal::configFactory()->listAll('node.type.'); foreach ($config_names as $config_name) {