Problem/Motivation
Noted in #3256642: Introduce database driver extensions and autoload database drivers' dependencies, https://git.drupalcode.org/project/drupal/-/merge_requests/3169#note_182014.
The InstallerNonDefaultDatabaseDriverTest asserts on actual strings of the settings.php file, which is brittle.
Steps to reproduce
Proposed resolution
Refactor to assert on arrays instead (from connection info?)
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3366862
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mondrakeComment #4
mondrakeComment #6
mondrakeFrom https://www.php.net/manual/en/function.include.php
So in this case,
$databasesis a local variable ofInstallerNonDefaultDatabaseDriverTest::getInstalledDatabaseSettings()coming from the evaluation of the code in the included settings.php file.Comment #7
daffie commentedNow I get it. Thanks for the explanation. Could you remove the
assert(isset($databases));from the PR and add a comment with your explanation? After that it is RTBC for me.Comment #8
mondrakeI had to add the assert since PHPStan was complaining more or less for the same reason of your comment - PHPStan cannot determine what's included in the include (pun intended), so we need to inform it that a variable with that name is existing at that point.
Once the parent is committed I will rebase and add a comment.
Comment #9
mondrakeDone.
Comment #10
daffie commentedAll code change look good to me.
The test has been improved.
For me it is RTBC.
Comment #11
alexpottBackported to 11.1.x as test-only change.
Committed and pushed c8a7a5894c9 to 11.x and 5f901886979 to 11.2.x and bc806750d89 to 11.1.x. Thanks!
Comment #15
alexpott