Remove URL generator priming in \Drupal\Tests\BrowserTestBase::installDrupal()

Created on 8 April 2021, over 3 years ago
Updated 21 June 2024, 3 months ago

Problem/Motivation

In #2189411: Remove an unnecessary container rebuild from FunctionalTestSetupTrait we removed a legacy call to drupal_flush_all_caches() but this had the unintended impact of causing \Drupal\Tests\node\Functional\Views\FrontPageTest to fail. This is because it uses \Drupal\views\Tests\AssertViewsCacheTagsTrait::assertViewsCacheTags() which is primarily designed to work in kernel tests. It does $request = new Request(); whereas it should be $request = Request::createFromGlobals(); so that it uses the $_SERVER settings done in \Drupal\Core\Test\FunctionalTestSetupTrait::setupBaseUrl(). Because it pushes an incorrect request onto the request stack, if the RequestContext is not yet initialised, the url generator with not be able to produce absolute urls.

Proposed resolution

Remove Url::fromRoute('<front>')->setAbsolute()->toString();.

Contrib / custom tests might need to be fixed but if so they are pushing a request to the request stack with incorrect info.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

@todo

📌 Task
Status

Fixed

Version

10.4

Component
PHPUnit 

Last updated less than a minute ago

Created by

🇬🇧United Kingdom alexpott 🇪🇺🌍

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024