#110708Unit tests leak global state into following tests
Description
Since the global state backup of unit tests is limited to test classes which opt in with the BackupGlobals attribute (#110624), a few unit tests leave global state behind, which breaks other tests in randomized unit test runs.
Tests leaking a request
ImageScriptServiceTest, IndexerTest, FileContentParserTest and YouTubeRendererTest set TYPO3_REQUEST in the globals and never unset it. The global state backup can not restore such request objects, so opting in to the backup does not help: YouTubeRendererTest opts in and still leaks its mocked request.
A following test reading the request fails, for example QueryFactoryTest::createDoesNotRespectStoragePageIfStaticOrRootLevelIsTrue and CorePasswordValidatorTest::validatorReturnsExpectedResults, with: No valid attribute applicationType found in request object.
Tests leaking configuration
RedisSessionBackendTest sets TYPO3_CONF_VARS SYS encryptionKey and PasswordGeneratorTest sets TYPO3_CONF_VARS SYS passwordPolicies, both without opting in to the global state backup. Both are reported by a unit test run with the options globals-backup and strict-global-state.
Steps to reproduce
bc. Build/Scripts/runTests.sh -s unit — —filter ‘QueryFactoryTest|ImageScriptServiceTest’ —order-by=random —random-order-seed=3
The same happens with IndexerTest instead of ImageScriptServiceTest, and in full randomized unit test runs, for example with the random seed 1789461382.
Solution
The tests leaking a request unset it on tear down, the tests leaking configuration opt in to the global state backup.
Reviews 2
History 14
-
Gerrit Code Review pushed patch set 1 for main to change 95847 status
NewUnder Review <span data-processor="relativetime" data-value="2026-09-15T09:05:37+00:00" > 09/15/26, 09:05 </span> -
Gerrit Code Review pushed patch set 2 for main to change 95847 <span data-processor="relativetime" data-value="2026-09-15T10:34:28+00:00" > 09/15/26, 10:34 </span>
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 95856 <span data-processor="relativetime" data-value="2026-09-15T13:06:51+00:00" > 09/15/26, 13:06 </span>
-
Stefan Bürk commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-09-15T13:20:09+00:00" > 09/15/26, 13:20 </span>
Applied in changeset commit:45ff8a26d5a2ed5161b7a7ed93e4cdc9d99d40ce.