Problem/Motivation
#3453474: CLI entry point in Drupal Core introduced Drupal\Core\Command\DrupalApplication and deprecated Drupal\Core\Command\BootableCommandTrait. Many of us worked on and reviewed #3453474, yet we all seemed to miss this incredibly important detail from BootableCommandTrait:
/**
* Gets the site path.
*
* Defaults to 'sites/default'. For testing purposes this can be overridden
* using the DRUPAL_DEV_SITE_PATH environment variable.
*
* @return string
* The site path to use.
*/
protected function getSitePath(): string {
return getenv('DRUPAL_DEV_SITE_PATH') ?: 'sites/default';
}
@phenaproxima reported in Slack:
So, I know
BootableCommandTraitis deprecated (good riddance; I wrote it). Nice. However, how do I forcedrto operate within the confines of the test site in a functional test? Previously, this was done by passing theDRUPAL_DEV_SITE_PATHenv var. What do I do now?
Steps to reproduce
Proposed resolution
Restore support for DRUPAL_DEV_SITE_PATH in DrupalApplication for all CLI commands.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3597406
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:
- 3597406-support-drupal_dev_site_path
changes, plain diff MR !16036
Comments
Comment #3
dwwProbably needs tests, but as an urgent hot-fix, maybe having @phenaproxima confirm drupal_cms tests are happy with this change is Good Enough(tm)?
Comment #5
phenaproximaThis helps me immensely. I worked a tad on this patch, yes, but given that this broke CMS's development process, I don't mind RTBCing it.
Comment #6
dwwFWIW, I reviewed @phenaproxima's commit here. It makes sense to me. We prefer invoking via
vendor/bin/drsince that givescomposera chance to setup the right class loader. He explained thatdrupal_cmsuses adrupal/core-recommendedsetup, so things aren't in the same places that we might expect from a raw core checkout like the default core test suite. His commit allowsRecipeTestTrait:: applyRecipe()to work regardless of how core is installed. +1 to that change (even if it's slightly out of scope aboutDRUPAL_DEV_SITE_PATH.So both authors reviewed each other's work. RTBC +1.
Comment #7
dwwRebased from
mainto resolve merge conflicts with #3597692: [regression] The `dr` command doesn't set DRUPAL_TEST_IN_CHILD_SITE.Comment #11
catchI'm going to go ahead here because it's blocking Drupal CMS testing, but tagging with 'needs follow-up' in case we want an explicit follow-up to deprecate this apart from the two issue linked by @mradclifffe