Problem/Motivation

This is a regression in 8.3.x introduced in #2796105: Move similar methods in BrowserTestBase / WebTestBase to a trait; untangle installDrupal().

settings.testing.php and testing.services.yml are not picked up by test classes extending BrowserTestBase.

The reason is that BrowserTestBase sets $this->originalSiteDirectory while FunctionalSetupTrait expects $this->originalSite to be set.

Proposed resolution

Fix BrowserTestBAse to set $this->originalSite instead.

Note that - because this affects the setup code of tests and in particular the interaction with the host system - this cannot be tested automatically.

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#4 2849222-4.patch906 byteststoeckler
#2 2796105-followup (1).patch906 byteststoeckler

Comments

tstoeckler created an issue. See original summary.

tstoeckler’s picture

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2: 2796105-followup (1).patch, failed testing.

tstoeckler’s picture

Status: Needs work » Needs review
StatusFileSize
new906 bytes

Hmm... not sure what happened there. Here is a fresh one.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community
xjm’s picture

Status: Reviewed & tested by the community » Needs review

No RTBCing your own patch, please. Thanks!

catch’s picture

Status: Needs review » Reviewed & tested by the community

I reviewed it and will RTBC - it's just correcting a variable name that wasn't adjusted with the conversion to the trait.

  • xjm committed f2f688b on 8.4.x
    Issue #2849222 by tstoeckler: settings.testing.php / testing.services....

  • xjm committed 3f1912d on 8.3.x
    Issue #2849222 by tstoeckler: settings.testing.php / testing.services....
xjm’s picture

Priority: Normal » Major
Status: Reviewed & tested by the community » Fixed

Thanks @catch!

At first I didn't see where $originalSite was documented, but as @catch pointed out it's in TestSetupTrait (not FunctionalTestSetupTrait). https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Test%21Te...

Checking the usages of both properties in HEAD:

[ibnsina:drupal | Wed 10:19:27] $ grep -r "originalSite" *
core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php:      'value' => $this->originalSite,
core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php:    $settings_testing_file = DRUPAL_ROOT . '/' . $this->originalSite . '/settings.testing.php';
core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php:    $settings_services_file = DRUPAL_ROOT . '/' . $this->originalSite . '/testing.services.yml';
core/lib/Drupal/Core/Test/TestSetupTrait.php:  protected $originalSite;
core/modules/simpletest/src/KernelTestBase.php:    $settings_services_file = DRUPAL_ROOT . '/' . $this->originalSite . '/testing.services.yml';
core/modules/simpletest/src/KernelTestBase.php:    $settings_testing_file = DRUPAL_ROOT . '/' . $this->originalSite . '/settings.testing.php';
core/modules/simpletest/src/KernelTestBase.php:    $settings['test_parent_site'] = $this->originalSite;
core/modules/simpletest/src/TestBase.php:    $this->originalSite = $site_path;
core/tests/Drupal/Tests/BrowserTestBase.php:  protected $originalSiteDirectory;
core/tests/Drupal/Tests/BrowserTestBase.php:    $this->originalSiteDirectory = $kernel->findSitePath($request);

With the patch, there are no remaining instances of originalSiteDirectory.

As @catch pointed out this is an 8.3.x regression and not testable. It also actually feels like a major bug to me. So I've committed it to 8.4.x and backported it to 8.3.x as well. Thanks!

tstoeckler’s picture

Re #6: The patch was already RTBC in the parent issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.