From 62b65430ed92fee13cd3e8bfb129d4d715a70d6b Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Thu, 25 Apr 2024 11:32:44 +0100
Subject: [PATCH] Issue #3442259 by catch, quietone, dww: Reduce time of
 Migrate Upgrade tests by not outputting the logs by default

---
 .../src/Functional/MigrateUpgradeExecuteTestBase.php      | 1 -
 .../tests/src/Functional/d6/Upgrade6Test.php              | 8 +++++---
 .../tests/src/Functional/d7/Upgrade7Test.php              | 8 +++++---
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php
index 3f767e48a73a..c5c1da46e845 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeExecuteTestBase.php
@@ -53,7 +53,6 @@ protected function setUp(): void {
   protected function tearDown(): void {
     if ($this->outputLogs) {
       $this->outputLogs($this->migratedAdminUserName);
-      $this->assertLogError();
     }
     parent::tearDown();
   }
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php
index 80aeb2697e26..060f7c32d279 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php
@@ -54,10 +54,11 @@ protected function setUp(): void {
 
     $this->loadFixture($this->getModulePath('migrate_drupal') . '/tests/fixtures/drupal6.php');
 
-    // Enable saving the logs and set the post migration admin user name.
-    $this->outputLogs = TRUE;
-    $this->migratedAdminUserName = 'root';
     $this->expectedLoggedErrors = 39;
+    // If saving the logs, then set the admin user.
+    if ($this->outputLogs) {
+      $this->migratedAdminUserName = 'admin';
+    }
   }
 
   /**
@@ -207,6 +208,7 @@ public function testUpgradeAndIncremental() {
     $this->assertFollowUpMigrationResults();
     $this->assertEntityRevisionsCount('node', 26);
     $this->assertEmailsSent();
+    $this->assertLogError();
   }
 
   /**
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php
index d34b6a4217c6..990af208a51b 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php
@@ -57,10 +57,11 @@ protected function setUp(): void {
 
     $this->loadFixture($this->getModulePath('migrate_drupal') . '/tests/fixtures/drupal7.php');
 
-    // Enable saving the logs and set the post migration admin user name.
-    $this->outputLogs = TRUE;
-    $this->migratedAdminUserName = 'admin';
     $this->expectedLoggedErrors = 27;
+    // If saving the logs, then set the admin user.
+    if ($this->outputLogs) {
+      $this->migratedAdminUserName = 'admin';
+    }
   }
 
   /**
@@ -233,6 +234,7 @@ public function testUpgradeAndIncremental() {
     $this->assertFollowUpMigrationResults();
     $this->assertEntityRevisionsCount('node', 19);
     $this->assertEmailsSent();
+    $this->assertLogError();
   }
 
   /**
-- 
GitLab