Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / system / tests / src / Functional / Module / InstallUninstallTest.php
index 61d3607810e6c8bd6ea972b4ccf8160f8b07afa2..9ca44078012f912e095e985a7eee411f520ff0e2 100644 (file)
@@ -4,6 +4,7 @@ namespace Drupal\Tests\system\Functional\Module;
 
 use Drupal\Component\Render\FormattableMarkup;
 use Drupal\Core\Logger\RfcLogLevel;
+use Drupal\workspaces\Entity\Workspace;
 
 /**
  * Install/uninstall core module and confirm table creation/deletion.
@@ -22,7 +23,8 @@ class InstallUninstallTest extends ModuleTestBase {
    */
   public function testInstallUninstall() {
     // Set a variable so that the hook implementations in system_test.module
-    // will display messages via drupal_set_message().
+    // will display messages via
+    // \Drupal\Core\Messenger\MessengerInterface::addStatus().
     $this->container->get('state')->set('system_test.verbose_module_hooks', TRUE);
 
     // Install and uninstall module_test to ensure hook_preinstall_module and
@@ -72,7 +74,7 @@ class InstallUninstallTest extends ModuleTestBase {
 
     // Go through each module in the list and try to install and uninstall
     // it with its dependencies.
-    while (list($name, $module) = each($all_modules)) {
+    foreach ($all_modules as $name => $module) {
       $was_installed_list = \Drupal::moduleHandler()->getModuleList();
 
       // Start a list of modules that we expect to be installed this time.
@@ -147,6 +149,12 @@ class InstallUninstallTest extends ModuleTestBase {
         $this->preUninstallForum();
       }
 
+      // Delete all workspaces before uninstall.
+      if ($name == 'workspaces') {
+        $workspaces = Workspace::loadMultiple();
+        \Drupal::entityTypeManager()->getStorage('workspace')->delete($workspaces);
+      }
+
       $now_installed_list = \Drupal::moduleHandler()->getModuleList();
       $added_modules = array_diff(array_keys($now_installed_list), array_keys($was_installed_list));
       while ($added_modules) {