Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
I always wondered why there is no dedicated method for resetting settings. I guess this is the design of a singleton, much like the german government.
You ensure that there is always one proper instance.
This bug also came up in #1808220: Remove run-tests.sh dependency on existing/installed parent site, although rather the "reverse"; i.e., if the test runner has no Settings at all, then various tests are failing, because there is no hash_salt setting. ;) — I've resolved that by instantiating a fake Settings object in run-tests.sh over there.
Not downgrading but does this even affect WebTestBase nowadays? I.e. shouldn't the $settings['hash_salt'] be set properly for the child site? In other words, if this only affects DrupalUnitTestBase shouldn't we reset the settings there?
It affects all tests (and test methods), including WebTestBase.
While it is true that WebTestBase installs a new Drupal site that creates new Settings, the Settings of the test runner would at least leak into the non-interactive installer that is executed by WebTestBase::setUp().
The rule is very simple: All global state constructs MUST be reset in TestBase::prepareEnvironment(). No exceptions.
Comments
Comment #1
sunKISS? :-)
Comment #3
sunThe test failure was related to the initial patch that was expected to fail.
Let's move forward with the KISS solution?
Comment #4
dawehnerI always wondered why there is no dedicated method for resetting settings. I guess this is the design of a singleton, much like the german government.
You ensure that there is always one proper instance.
Comment #5
sunComment #6
sun1: drupal8.test-settings.1.patch queued for re-testing.
Comment #7
sunThis bug also came up in #1808220: Remove run-tests.sh dependency on existing/installed parent site, although rather the "reverse"; i.e., if the test runner has no
Settingsat all, then various tests are failing, because there is no hash_salt setting. ;) — I've resolved that by instantiating a fakeSettingsobject in run-tests.sh over there.Would be great to move forward here.
Comment #8
longwaveExplanation in #2165549: Reduce number of password hashing iterations in all tests to improve test performance makes sense to me, simple patch => RTBC
Comment #9
tstoecklerNot downgrading but does this even affect WebTestBase nowadays? I.e. shouldn't the $settings['hash_salt'] be set properly for the child site? In other words, if this only affects DrupalUnitTestBase shouldn't we reset the settings there?
Comment #10
sunIt affects all tests (and test methods), including
WebTestBase.While it is true that
WebTestBaseinstalls a new Drupal site that creates newSettings, theSettingsof the test runner would at least leak into the non-interactive installer that is executed byWebTestBase::setUp().The rule is very simple: All global state constructs MUST be reset in
TestBase::prepareEnvironment(). No exceptions.Comment #11
webchickCommitted and pushed to 8.x. Thanks!