diff --git a/Tests/Unit/Domain/Variants/IdBuilderTest.php b/Tests/Unit/Domain/Variants/IdBuilderTest.php index 157c642946..845ea629d0 100644 --- a/Tests/Unit/Domain/Variants/IdBuilderTest.php +++ b/Tests/Unit/Domain/Variants/IdBuilderTest.php @@ -32,21 +32,6 @@ */ class IdBuilderTest extends SetUpUnitTestCase { - protected string $oldEncryptionKey; - - protected function setUp(): void - { - $this->oldEncryptionKey = $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']; - $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = 'testkey'; - parent::setUp(); - } - - protected function tearDown(): void - { - $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = $this->oldEncryptionKey; - parent::tearDown(); - } - /** * @test */ @@ -54,7 +39,7 @@ public function canBuildVariantId(): void { $build = new IdBuilder(new NoopEventDispatcher()); $variantId = $build->buildFromTypeAndUid('pages', 4711, [], $this->createMock(Site::class), new Document()); - self::assertSame('e99b3552a0451f1a2e7aca4ac06ccaba063393de/pages/4711', $variantId); + self::assertSame('c523304ea47711019595d2bb352b623d1db40427/pages/4711', $variantId); } /** diff --git a/Tests/Unit/SetUpUnitTestCase.php b/Tests/Unit/SetUpUnitTestCase.php index 068ee87ba0..1cfb0b9926 100644 --- a/Tests/Unit/SetUpUnitTestCase.php +++ b/Tests/Unit/SetUpUnitTestCase.php @@ -27,13 +27,25 @@ abstract class SetUpUnitTestCase extends UnitTestCase { protected bool $resetSingletonInstances = true; + protected ?string $originalEncryptionKey; protected function setUp(): void { date_default_timezone_set('Europe/Berlin'); + $this->originalEncryptionKey = $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] ?? null; + $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = 'solr-tests-secret-encryption-key'; parent::setUp(); } + protected function tearDown(): void + { + unset($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']); + if ($this->originalEncryptionKey !== null) { + $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = $this->originalEncryptionKey; + } + parent::tearDown(); + } + /** * Returns the absolute root path to the fixtures. *