From c2f63b00eaa98c92bf0dc6b71bdbd43b9abe5dce Mon Sep 17 00:00:00 2001
From: Christian Kuhn <lolli@schwarzbu.ch>
Date: Mon, 6 Dec 2021 20:07:50 +0100
Subject: [PATCH] [TASK] Avoid static DatabaseSnashot setup in functional tests

The testing-framework simplified database snapshotting.
Calling static initializeDatabaseSnapshot() and
tearDownAfterClass() are on longer needed.

composer req --dev typo3/testing-framework:^6.15.1

Change-Id: I0921d8c0c99d2dc677a607a0ba3eecbb1bf39763
Resolves: #96264
Releases: main, 11.5
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72530
Tested-by: core-ci <typo3@b13.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 composer.json                                      |  2 +-
 composer.lock                                      | 14 +++++++-------
 .../Tests/Functional/Clipboard/ClipboardTest.php   | 12 ------------
 .../View/Drawing/BackendLayoutRendererTest.php     | 12 ------------
 .../Routing/Aspect/PersistedAliasMapperTest.php    | 12 ------------
 .../Routing/Aspect/PersistedPatternMapperTest.php  | 12 ------------
 .../Functional/Utility/RootlineUtilityTest.php     |  8 --------
 .../Rendering/SecureHtmlRenderingTest.php          | 12 ------------
 .../Rendering/SecureHtmlRenderingTest.php          | 12 ------------
 .../Functional/SiteHandling/EidRequestTest.php     | 12 ------------
 .../AbstractEnhancerLinkGeneratorTestCase.php      | 12 ------------
 .../AbstractEnhancerSiteRequestTest.php            | 12 ------------
 .../AbstractLocalizedPagesTestCase.php             | 12 ------------
 .../Functional/SiteHandling/MountPointTest.php     | 12 ------------
 .../Functional/SiteHandling/SiteRequestTest.php    | 12 ------------
 .../SiteHandling/SlugLinkGeneratorTest.php         | 12 ------------
 .../SiteHandling/SlugSiteRequestTest.php           | 12 ------------
 .../SiteHandling/TypoLinkGeneratorTest.php         | 12 ------------
 .../Functional/HrefLang/HrefLangGeneratorTest.php  | 12 ------------
 19 files changed, 8 insertions(+), 208 deletions(-)

diff --git a/composer.json b/composer.json
index 7f687f24a89c..b2c8d44d7a42 100644
--- a/composer.json
+++ b/composer.json
@@ -112,7 +112,7 @@
 		"phpstan/phpstan": "^0.12.99",
 		"phpunit/phpunit": "^9.5.10",
 		"typo3/cms-styleguide": "~11.5.3",
-		"typo3/testing-framework": "^6.15.0"
+		"typo3/testing-framework": "^6.15.1"
 	},
 	"suggest": {
 		"ext-gd": "GDlib/Freetype is required for building images with text (GIFBUILDER) and can also be used to scale images",
diff --git a/composer.lock b/composer.lock
index 2e9e1eb3ed0d..ec83fa9ae496 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "859b99533bbd022fcf67897ca6599fb8",
+    "content-hash": "0052f0ba386e34ed16bfca0c0ff066a1",
     "packages": [
         {
             "name": "bacon/bacon-qr-code",
@@ -8209,16 +8209,16 @@
         },
         {
             "name": "typo3/testing-framework",
-            "version": "6.15.0",
+            "version": "6.15.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/TYPO3/testing-framework.git",
-                "reference": "92510b0ce82b116fda173c7df93e5ab7e3d2040d"
+                "reference": "ba62393db03e28f80fc53191f039fbda28362c1d"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/TYPO3/testing-framework/zipball/92510b0ce82b116fda173c7df93e5ab7e3d2040d",
-                "reference": "92510b0ce82b116fda173c7df93e5ab7e3d2040d",
+                "url": "https://api.github.com/repos/TYPO3/testing-framework/zipball/ba62393db03e28f80fc53191f039fbda28362c1d",
+                "reference": "ba62393db03e28f80fc53191f039fbda28362c1d",
                 "shasum": ""
             },
             "require": {
@@ -8271,9 +8271,9 @@
             "support": {
                 "general": "https://typo3.org/support/",
                 "issues": "https://github.com/TYPO3/testing-framework/issues",
-                "source": "https://github.com/TYPO3/testing-framework/tree/6.15.0"
+                "source": "https://github.com/TYPO3/testing-framework/tree/6.15.1"
             },
-            "time": "2021-11-27T12:48:15+00:00"
+            "time": "2021-12-06T19:02:31+00:00"
         }
     ],
     "aliases": [],
diff --git a/typo3/sysext/backend/Tests/Functional/Clipboard/ClipboardTest.php b/typo3/sysext/backend/Tests/Functional/Clipboard/ClipboardTest.php
index 8967bf04265c..8eb8703b4463 100644
--- a/typo3/sysext/backend/Tests/Functional/Clipboard/ClipboardTest.php
+++ b/typo3/sysext/backend/Tests/Functional/Clipboard/ClipboardTest.php
@@ -41,18 +41,6 @@ class ClipboardTest extends FunctionalTestCase
     private Clipboard $subject;
     private BackendUserAuthentication $backendUser;
 
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
diff --git a/typo3/sysext/backend/Tests/Functional/View/Drawing/BackendLayoutRendererTest.php b/typo3/sysext/backend/Tests/Functional/View/Drawing/BackendLayoutRendererTest.php
index 616cf39ac71f..e4fa7693ac44 100644
--- a/typo3/sysext/backend/Tests/Functional/View/Drawing/BackendLayoutRendererTest.php
+++ b/typo3/sysext/backend/Tests/Functional/View/Drawing/BackendLayoutRendererTest.php
@@ -45,18 +45,6 @@ class BackendLayoutRendererTest extends FunctionalTestCase
      */
     private BackendUserAuthentication $backendUser;
 
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
diff --git a/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedAliasMapperTest.php b/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedAliasMapperTest.php
index 40c285b4ea2d..3d7049153598 100644
--- a/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedAliasMapperTest.php
+++ b/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedAliasMapperTest.php
@@ -69,18 +69,6 @@ class PersistedAliasMapperTest extends FunctionalTestCase
      */
     private $sites;
 
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
diff --git a/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedPatternMapperTest.php b/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedPatternMapperTest.php
index 437ead41531a..19c6bc736627 100644
--- a/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedPatternMapperTest.php
+++ b/typo3/sysext/core/Tests/Functional/Routing/Aspect/PersistedPatternMapperTest.php
@@ -73,18 +73,6 @@ class PersistedPatternMapperTest extends FunctionalTestCase
      */
     private $sites;
 
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
diff --git a/typo3/sysext/core/Tests/Functional/Utility/RootlineUtilityTest.php b/typo3/sysext/core/Tests/Functional/Utility/RootlineUtilityTest.php
index 56e39c8c2bf7..da1ff1a51e73 100644
--- a/typo3/sysext/core/Tests/Functional/Utility/RootlineUtilityTest.php
+++ b/typo3/sysext/core/Tests/Functional/Utility/RootlineUtilityTest.php
@@ -66,17 +66,9 @@ class RootlineUtilityTest extends FunctionalTestCase
         });
     }
 
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
     public static function tearDownAfterClass(): void
     {
         RootlineUtility::purgeCaches();
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
     }
 
     protected function setUpDatabase(): void
diff --git a/typo3/sysext/fluid_styled_content/Tests/Functional/Rendering/SecureHtmlRenderingTest.php b/typo3/sysext/fluid_styled_content/Tests/Functional/Rendering/SecureHtmlRenderingTest.php
index 6ff13a13fe8d..29d2ba4832e7 100644
--- a/typo3/sysext/fluid_styled_content/Tests/Functional/Rendering/SecureHtmlRenderingTest.php
+++ b/typo3/sysext/fluid_styled_content/Tests/Functional/Rendering/SecureHtmlRenderingTest.php
@@ -51,18 +51,6 @@ class SecureHtmlRenderingTest extends FunctionalTestCase
      */
     protected $coreExtensionsToLoad = ['fluid_styled_content'];
 
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
diff --git a/typo3/sysext/fluid_styled_content/Tests/FunctionalDeprecated/Rendering/SecureHtmlRenderingTest.php b/typo3/sysext/fluid_styled_content/Tests/FunctionalDeprecated/Rendering/SecureHtmlRenderingTest.php
index 1881aa0f840f..09a0d2c1a413 100644
--- a/typo3/sysext/fluid_styled_content/Tests/FunctionalDeprecated/Rendering/SecureHtmlRenderingTest.php
+++ b/typo3/sysext/fluid_styled_content/Tests/FunctionalDeprecated/Rendering/SecureHtmlRenderingTest.php
@@ -50,18 +50,6 @@ class SecureHtmlRenderingTest extends FunctionalTestCase
      */
     protected $coreExtensionsToLoad = ['fluid_styled_content'];
 
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/EidRequestTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/EidRequestTest.php
index 0268430a0027..5c2431c344be 100644
--- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/EidRequestTest.php
+++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/EidRequestTest.php
@@ -34,18 +34,6 @@ class EidRequestTest extends AbstractTestCase
         'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_eid',
     ];
 
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerLinkGenerator/AbstractEnhancerLinkGeneratorTestCase.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerLinkGenerator/AbstractEnhancerLinkGeneratorTestCase.php
index 91c3a9065717..07af0d6e8629 100644
--- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerLinkGenerator/AbstractEnhancerLinkGeneratorTestCase.php
+++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerLinkGenerator/AbstractEnhancerLinkGeneratorTestCase.php
@@ -31,18 +31,6 @@ use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
  */
 abstract class AbstractEnhancerLinkGeneratorTestCase extends AbstractTestCase
 {
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerSiteRequest/AbstractEnhancerSiteRequestTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerSiteRequest/AbstractEnhancerSiteRequestTest.php
index 69598a9435fe..d26aade153ca 100644
--- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerSiteRequest/AbstractEnhancerSiteRequestTest.php
+++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/EnhancerSiteRequest/AbstractEnhancerSiteRequestTest.php
@@ -32,18 +32,6 @@ use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
  */
 abstract class AbstractEnhancerSiteRequestTest extends AbstractTestCase
 {
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/AbstractLocalizedPagesTestCase.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/AbstractLocalizedPagesTestCase.php
index 1e2f38dbc290..1a41bac23802 100644
--- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/AbstractLocalizedPagesTestCase.php
+++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/LocalizedPageRendering/AbstractLocalizedPagesTestCase.php
@@ -32,18 +32,6 @@ abstract class AbstractLocalizedPagesTestCase extends AbstractTestCase
         'DE-CH' => ['id' => 2, 'title' => 'Swiss German', 'locale' => 'de_CH.UTF8', 'iso' => 'de', 'hrefLang' => 'de-CH', 'direction' => ''],
     ];
 
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUpDatabaseWithYamlPayload(string $pathToYamlFile): void
     {
         $this->withDatabaseSnapshot(function () use ($pathToYamlFile) {
diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/MountPointTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/MountPointTest.php
index 940b33c6ab82..52c550a72d68 100644
--- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/MountPointTest.php
+++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/MountPointTest.php
@@ -61,18 +61,6 @@ use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\ResponseContent;
  */
 class MountPointTest extends AbstractTestCase
 {
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SiteRequestTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SiteRequestTest.php
index 6b54a042d147..80ee0d6e37d7 100644
--- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SiteRequestTest.php
+++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SiteRequestTest.php
@@ -30,18 +30,6 @@ use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\ResponseContent;
  */
 class SiteRequestTest extends AbstractTestCase
 {
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugLinkGeneratorTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugLinkGeneratorTest.php
index d1e55d508a02..b518b84c9aa8 100644
--- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugLinkGeneratorTest.php
+++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugLinkGeneratorTest.php
@@ -31,18 +31,6 @@ use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequestCon
  */
 class SlugLinkGeneratorTest extends AbstractTestCase
 {
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php
index 4c1f2d632d60..24c33dbb154f 100644
--- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php
+++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php
@@ -54,18 +54,6 @@ class SlugSiteRequestTest extends AbstractTestCase
         ],
     ];
 
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/TypoLinkGeneratorTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/TypoLinkGeneratorTest.php
index 1e6449e23d83..1f408f3b5427 100644
--- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/TypoLinkGeneratorTest.php
+++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/TypoLinkGeneratorTest.php
@@ -42,18 +42,6 @@ class TypoLinkGeneratorTest extends AbstractTestCase
         'typo3/sysext/backend/Resources/Public/Images/Logo.png' => 'fileadmin/logo.png',
     ];
 
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
diff --git a/typo3/sysext/seo/Tests/Functional/HrefLang/HrefLangGeneratorTest.php b/typo3/sysext/seo/Tests/Functional/HrefLang/HrefLangGeneratorTest.php
index e4c3c53467a9..3aa07eaab657 100644
--- a/typo3/sysext/seo/Tests/Functional/HrefLang/HrefLangGeneratorTest.php
+++ b/typo3/sysext/seo/Tests/Functional/HrefLang/HrefLangGeneratorTest.php
@@ -44,18 +44,6 @@ class HrefLangGeneratorTest extends FunctionalTestCase
         'FR' => ['id' => 4, 'title' => 'French', 'locale' => 'fr_FR.UTF8', 'iso' => 'fr', 'hrefLang' => 'fr-FR', 'direction' => ''],
     ];
 
-    public static function setUpBeforeClass(): void
-    {
-        parent::setUpBeforeClass();
-        static::initializeDatabaseSnapshot();
-    }
-
-    public static function tearDownAfterClass(): void
-    {
-        static::destroyDatabaseSnapshot();
-        parent::tearDownAfterClass();
-    }
-
     protected function setUp(): void
     {
         parent::setUp();
-- 
GitLab