diff --git a/typo3/sysext/backend/Tests/Unit/Controller/FormInlineAjaxControllerTest.php b/typo3/sysext/backend/Tests/Unit/Controller/FormInlineAjaxControllerTest.php
index b2d8d119cfc44fee24e8345aac6dd1ccfd637f94..1a8433685e67a2cb3d78ce89d8c74772d474c4d7 100644
--- a/typo3/sysext/backend/Tests/Unit/Controller/FormInlineAjaxControllerTest.php
+++ b/typo3/sysext/backend/Tests/Unit/Controller/FormInlineAjaxControllerTest.php
@@ -24,6 +24,12 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 final class FormInlineAjaxControllerTest extends UnitTestCase
 {
+    protected function setUp(): void
+    {
+        parent::setUp();
+        $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '';
+    }
+
     /**
      * @test
      */
diff --git a/typo3/sysext/core/Tests/Unit/FormProtection/AbstractFormProtectionTest.php b/typo3/sysext/core/Tests/Unit/FormProtection/AbstractFormProtectionTest.php
index d05ab6a73c2768a96b0fa875c489b5c7807a0f83..0e0d2b6585b0a108f3805fbd232bea80139c82da 100644
--- a/typo3/sysext/core/Tests/Unit/FormProtection/AbstractFormProtectionTest.php
+++ b/typo3/sysext/core/Tests/Unit/FormProtection/AbstractFormProtectionTest.php
@@ -31,11 +31,9 @@ final class AbstractFormProtectionTest extends UnitTestCase
     {
         parent::setUp();
         $this->subject = new FormProtectionTesting();
+        $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '';
     }
 
-    /////////////////////////////////////////
-    // Tests concerning the basic functions
-    /////////////////////////////////////////
     /**
      * @test
      */
@@ -85,9 +83,6 @@ final class AbstractFormProtectionTest extends UnitTestCase
         $subject->clean();
     }
 
-    ///////////////////////////////////
-    // Tests concerning generateToken
-    ///////////////////////////////////
     /**
      * @test
      */
@@ -138,9 +133,6 @@ final class AbstractFormProtectionTest extends UnitTestCase
         self::assertEquals($this->subject->generateToken('foo', 'edit', 'bar'), $this->subject->generateToken('foo', 'edit', 'bar'));
     }
 
-    ///////////////////////////////////
-    // Tests concerning validateToken
-    ///////////////////////////////////
     /**
      * @test
      */
diff --git a/typo3/sysext/core/Tests/Unit/FormProtection/BackendFormProtectionTest.php b/typo3/sysext/core/Tests/Unit/FormProtection/BackendFormProtectionTest.php
index 2d9a7d348736880ee572c6db59e5d080745ca28d..2848da7385a3e82cde04c22606995104663e7359 100644
--- a/typo3/sysext/core/Tests/Unit/FormProtection/BackendFormProtectionTest.php
+++ b/typo3/sysext/core/Tests/Unit/FormProtection/BackendFormProtectionTest.php
@@ -41,6 +41,7 @@ final class BackendFormProtectionTest extends UnitTestCase
                 throw new \Exception('Closure called', 1442592030);
             }
         );
+        $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '';
     }
 
     /**
diff --git a/typo3/sysext/core/Tests/Unit/FormProtection/InstallToolFormProtectionTest.php b/typo3/sysext/core/Tests/Unit/FormProtection/InstallToolFormProtectionTest.php
index 3dcf3167565c111614e5b03da55a920cdc03e5dc..4571d68407082fccf958a93811ae18fee3e6ba6a 100644
--- a/typo3/sysext/core/Tests/Unit/FormProtection/InstallToolFormProtectionTest.php
+++ b/typo3/sysext/core/Tests/Unit/FormProtection/InstallToolFormProtectionTest.php
@@ -23,6 +23,12 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 final class InstallToolFormProtectionTest extends UnitTestCase
 {
+    protected function setUp(): void
+    {
+        parent::setUp();
+        $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '';
+    }
+
     /**
      * @test
      */
diff --git a/typo3/sysext/core/Tests/Unit/Page/ImportMapTest.php b/typo3/sysext/core/Tests/Unit/Page/ImportMapTest.php
index f5f64a2670956a3ec5f9cef0c8d11df8a17cc345..211d58cce5afea52b83b226b665504d5da0f95a6 100644
--- a/typo3/sysext/core/Tests/Unit/Page/ImportMapTest.php
+++ b/typo3/sysext/core/Tests/Unit/Page/ImportMapTest.php
@@ -51,6 +51,7 @@ final class ImportMapTest extends UnitTestCase
         );
         $this->backupPackageManager = \Closure::bind(fn(): PackageManager => ExtensionManagementUtility::$packageManager, null, ExtensionManagementUtility::class)();
         ExtensionManagementUtility::setPackageManager($this->mockPackageManager());
+        $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '';
     }
 
     protected function tearDown(): void
diff --git a/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php b/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
index 5aad9563274c2b95ec9e4bb2ced254a274d631a0..f511dd452e068c9fedbd5935596e174df76dfbf6 100644
--- a/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
+++ b/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
@@ -1780,6 +1780,7 @@ final class GeneralUtilityTest extends UnitTestCase
      */
     public function hmacReturnsHashOfProperLength(): void
     {
+        $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '';
         $hmac = GeneralUtility::hmac('message');
         self::assertTrue(!empty($hmac) && is_string($hmac));
         self::assertEquals(strlen($hmac), 40);
@@ -1790,6 +1791,7 @@ final class GeneralUtilityTest extends UnitTestCase
      */
     public function hmacReturnsEqualHashesForEqualInput(): void
     {
+        $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '';
         $msg0 = 'message';
         $msg1 = 'message';
         self::assertEquals(GeneralUtility::hmac($msg0), GeneralUtility::hmac($msg1));
@@ -1800,6 +1802,7 @@ final class GeneralUtilityTest extends UnitTestCase
      */
     public function hmacReturnsNoEqualHashesForNonEqualInput(): void
     {
+        $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '';
         $msg0 = 'message0';
         $msg1 = 'message1';
         self::assertNotEquals(GeneralUtility::hmac($msg0), GeneralUtility::hmac($msg1));
diff --git a/typo3/sysext/form/Tests/Unit/Domain/Configuration/FormDefinitionConversionServiceTest.php b/typo3/sysext/form/Tests/Unit/Domain/Configuration/FormDefinitionConversionServiceTest.php
index 9f2360b282e90dd92b6c68d35d9be41ead512051..f45864c60463223103e2e918ed3e742141718652 100644
--- a/typo3/sysext/form/Tests/Unit/Domain/Configuration/FormDefinitionConversionServiceTest.php
+++ b/typo3/sysext/form/Tests/Unit/Domain/Configuration/FormDefinitionConversionServiceTest.php
@@ -30,6 +30,7 @@ final class FormDefinitionConversionServiceTest extends UnitTestCase
      */
     public function addHmacDataAddsHmacHashes(): void
     {
+        $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '';
         $formDefinitionConversionService = $this->getAccessibleMock(
             FormDefinitionConversionService::class,
             [
diff --git a/typo3/sysext/form/Tests/Unit/Domain/Configuration/FormDefinitionValidationServiceTest.php b/typo3/sysext/form/Tests/Unit/Domain/Configuration/FormDefinitionValidationServiceTest.php
index 0c66bc9ecf422e7e4d546af830eb640dfecae2e3..3554fa39e7d5ccb4f6c06af61bf1d03bd1f3074e 100644
--- a/typo3/sysext/form/Tests/Unit/Domain/Configuration/FormDefinitionValidationServiceTest.php
+++ b/typo3/sysext/form/Tests/Unit/Domain/Configuration/FormDefinitionValidationServiceTest.php
@@ -247,7 +247,8 @@ final class FormDefinitionValidationServiceTest extends UnitTestCase
 
     public static function validateAllPropertyValuesFromCreatableFormElementDataProvider(): array
     {
-        $encryptionKeyBackup = $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
+        // Be aware that the $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] assignment in setUp is done
+        // after the dataProvider intitialization. Therefore, the encryption key must also be defined here.
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '12345';
 
         $sessionToken = '54321';
@@ -274,8 +275,9 @@ final class FormDefinitionValidationServiceTest extends UnitTestCase
             ],
         ];
 
-        // be aware that backup globals does not impact globals used in data providers as these are called before the setUp/tearDown is done
-        $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = $encryptionKeyBackup;
+        // Unset global encryption key, so following tests do not use it. Data providers are not covered by phpunit backupGlobals.
+        // @todo: Refactor this out of the data provider.
+        unset($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']);
 
         return [
             [
@@ -422,7 +424,8 @@ final class FormDefinitionValidationServiceTest extends UnitTestCase
 
     public static function validateAllPropertyValuesFromCreatablePropertyCollectionElementDataProvider(): array
     {
-        $encryptionKeyBackup = $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
+        // Be aware that the $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] assignment in setUp is done
+        // after the dataProvider intitialization. Therefore, the encryption key must also be defined here.
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '12345';
 
         $sessionToken = '54321';
@@ -449,8 +452,9 @@ final class FormDefinitionValidationServiceTest extends UnitTestCase
             ],
         ];
 
-        // be aware that backup globals does not impact globals used in data providers as these are called before the setUp/tearDown is done
-        $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = $encryptionKeyBackup;
+        // Unset global encryption key, so following tests do not use it. Data providers are not covered by phpunit backupGlobals.
+        // @todo: Refactor this out of the data provider.
+        unset($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']);
 
         return [
             [
diff --git a/typo3/sysext/frontend/Tests/Unit/Middleware/PageArgumentValidatorTest.php b/typo3/sysext/frontend/Tests/Unit/Middleware/PageArgumentValidatorTest.php
index 62a473275b0762b66cef235a68931089d60023cd..19b13f4e8c19f38762b9c3b0e1e1fa36df983ec3 100644
--- a/typo3/sysext/frontend/Tests/Unit/Middleware/PageArgumentValidatorTest.php
+++ b/typo3/sysext/frontend/Tests/Unit/Middleware/PageArgumentValidatorTest.php
@@ -55,6 +55,7 @@ final class PageArgumentValidatorTest extends UnitTestCase
                 return new Response();
             }
         };
+        $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '';
     }
 
     /**