Closed (duplicate)
Project:
Drupal core
Version:
9.0.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
25 Sep 2019 at 13:15 UTC
Updated:
17 Feb 2020 at 23:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
wim leersSomething like this.
Comment #4
mile23Hmm. Ok, so
UpdatePathTestBase::$installProfileis written to['settings']['install_profile']inUpdatePathTestBase::prepareSettings().So we search around for how the
install_profilesetting is used, and discover thatinstall_write_profile()was deprecated in 8.3.0 along with this setting, but neither has a change record:It seems as though we’re testing whether a given database dump can be updated. Since that’s the case, we still have to write out the
install_profilesetting for older versions of core.Is it functionally the same as the test profile, though? In the case of
NoDependenciesUpdateTestwe open the gzip fixture (drupal-8.6.0.bare.testing.php.gz) and search for profile information. Hey look,core.extensionsays:s:7:"profile";s:7:"testing";which matchesNoDependenciesUpdateTestsaying:protected $installProfile = 'testing';This suggests that we want to do an install using the same profile as the fixture. Too bad no one wrote that down in the docblock ofUpdatePathTestBase. Regardless, for this particular fixture it shouldn’t actually matter whether we write out theinstall_profilesetting.In fact, if we change the patch in #2 to say
NoDependenciesUpdateTest::$installProfile = NULL;we get a passing test, since the fixture is newer than core 8.3.0. We can even comment out the part that writes that setting fromUpdatePathTestBaseand get a passing test.However, if we quit using
$installProfile, the patch in #2 gives us basically 200+ fails with the same error message: “Exception: User warning: The following module is missing from the file system: standard”. So where does the standard profile come from? It comes from the fixture.The answer to the question: ‘Does this need to be separate from
BTB::$profile?’ is yes. It represents a different configuration, because it will be written out to the settings file. And there are circumstances where it probably shouldn’t be written out because we're testing a newer version of core.I think
BTB::$profileends up being ignored for the installed fixture site, in favor of either theinstall_profilesetting, or thecore.extensionconfig within the fixture, depending on the fixture.In my ideal world
UpdatePathTestBase::$installProfileshould default to NULL, to be overridden and set by tests which explicitly need it. It should also get a docblock update so you know you might not need to write it out to the settings file.Also,
UpdatePathTestBase::prepareSettings()should conditionally write the setting if it’s not NULL.Here’s a patch that does this, and it should have the same fails as #2. But the reason it has the same fails is because the tests are using fixtures that were generated for core versions < 8.3.0, and so they need the install_profile setting in the settings file. The fix to that is that they explicitly declare that they need that
$installProfile.Note that we also journey down a path where we get to
DrupalKernel::getInstallProfile(), which says this:#2831065: Remove BC layer from \Drupal\Core\DrupalKernel::getInstallProfile() wants us to remove this BC layer, and when we do, these tests will probably explode again.
Comment #6
dwwThanks for opening this, @Wim Leers.
Re: #4: Wow. Just wow. ;) @Mile23++ What a tangled web we weave...
Heh, so #2 fails 201 times, but #4 only fails 197 times (yet has 11 more successful tests?). Fun!
Okay, back to $day_job... I can't afford to go down this rabbit hole much further with y'all today. ;)
Comment #7
mile23Similar, different, related.
Comment #8
Jaesin commentedIn this case, could we renaming it to
$siteSettingsInstallProfileor something similar.Since the value should really be the same between
$profileand$installProfile, could we introduce a new variable that indicates if the value can be written to the settings file and still get rid of the$installProfilevariable.Comment #9
Jaesin commentedOops.
Comment #10
mile23What I found in #4 was that it's safe to say that
$profileis always overridden by the fixture.$profileis supposed to be the profile you need for the test to run within, but we never actually need to set that forUpdatePathTestBasetests.$installProfileis a setting that's written out to the settings file, and we only need to do that for some fixtures. If the fixture db dump is from Drupal 8.3.0 or newer, we don't need to (and maybe shouldn't).So we should:
UpdatePathTestBase::$profileto a profile that doesn't exist (as in #4), so that if the fixture somehow doesn't have a profile we'll get a fail.UpdatePathTestBase::$installProfileto eitherNULLor default tostandard. If we set it toNULL, then the tests that need to write the settings file will have to explicitly set it, which is good for the test. If we set it tostandardthe current tests will pass like they have in the past.$installProfilebecause we need it for some tests.Renaming to
$siteSettingsInstallProfileis totally OK, just as long as we document what it does.Comment #11
wim leersImpressive investigative work, @Mile23! Thanks 🙏👏
Comment #13
alexpottI think in a Drupal 9 world this issue has moved on as we expect all database dumps to start from 8.8.0 or greater. So I think once #3109433: Set install profile correctly in the 8.8 database dumps is done we can remove $installProfile completely. It has no effect on dumps created after system_update_8601(). And all update path tests in Drupal 9 need to start from Drupal 8.8.0.
Comment #14
alexpottWe can remove all of this. And if we like add a deprecation to UpdatePathTestBase that if $this->installProfile is set it is ignored. Note we cannot make these changes in Drupal 8 because dumps older that 8.0.0 are supported.
Comment #15
longwaveI think this is all gone now - removed in #2831065: Remove BC layer from \Drupal\Core\DrupalKernel::getInstallProfile()