From d68a28b4934e6412b33c9e4902e6e6fe3e46376e Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Mon, 10 Jul 2023 17:56:28 +0100
Subject: [PATCH] Issue #3360167 by longwave, mondrake, Spokje: Simplification
 in UpdatePathTestBase

---
 .../Update/UpdatePathTestBase.php             | 50 ++-----------------
 1 file changed, 3 insertions(+), 47 deletions(-)

diff --git a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
index f15c1a4f51a5..4668f611c6b9 100644
--- a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
@@ -65,41 +65,6 @@ abstract class UpdatePathTestBase extends BrowserTestBase {
    */
   protected $databaseDumpFiles = [];
 
-  /**
-   * Flag that indicates whether the child site has been updated.
-   *
-   * @var bool
-   */
-  protected $upgradedSite = FALSE;
-
-  /**
-   * Array of errors triggered during the update process.
-   *
-   * @var array
-   */
-  protected $upgradeErrors = [];
-
-  /**
-   * Array of modules loaded when the test starts.
-   *
-   * @var array
-   */
-  protected $loadedModules = [];
-
-  /**
-   * Flag to indicate whether zlib is installed or not.
-   *
-   * @var bool
-   */
-  protected $zlibInstalled = TRUE;
-
-  /**
-   * Flag to indicate whether there are pending updates or not.
-   *
-   * @var bool
-   */
-  protected $pendingUpdates = TRUE;
-
   /**
    * The update URL.
    *
@@ -120,7 +85,9 @@ abstract class UpdatePathTestBase extends BrowserTestBase {
    * {@inheritdoc}
    */
   protected function setUp(): void {
-    $this->zlibInstalled = function_exists('gzopen');
+    if (!extension_loaded('zlib')) {
+      $this->markTestSkipped('The zlib extension is not available.');
+    }
 
     parent::setUp();
   }
@@ -141,13 +108,6 @@ public function installDrupal() {
     // the updates.
     $this->updateUrl = Url::fromRoute('system.db_update', [], ['path_processing' => FALSE]);
 
-    // We are going to set a missing zlib requirement property for usage
-    // during the performUpgrade() and tearDown() methods. Also set that the
-    // tests failed.
-    if (!$this->zlibInstalled) {
-      return;
-    }
-
     $this->initUserSession();
     $this->prepareSettings();
     $this->doInstall();
@@ -240,10 +200,6 @@ protected function prepareSettings() {
    * Helper function to run pending database updates.
    */
   protected function runUpdates() {
-    if (!$this->zlibInstalled) {
-      $this->fail('Missing zlib requirement for update tests.');
-      return FALSE;
-    }
     $this->doRunUpdates($this->updateUrl);
   }
 
-- 
GitLab