Add getHttpClient() to BrowserTestBase

Created on 26 September 2017, about 7 years ago
Updated 12 September 2023, about 1 year ago

Problem/Motivation

Working on #2870458: Convert web tests to browser tests for quickedit module I realized there's no direct replacement for WTB::drupalPost().

This got me searching through core for 'x-www-form-urlencoded' in order to see if I was missing something.

It turns out a number of tests make direct calls with curl, which is what WTB::drupalPost() does.

For instance here's a WTB: Drupal\node\Tests\Views\NodeContextualLinksTest::renderContextualLinks().

And here's a BTB: Drupal\Tests\history\Functional\HistoryTest::getNodeReadTimestamps().

There are many outlier WTB tests awaiting conversion to BTB, and it seems that they're outliers because there's no direct conversion for drupalPost(). And there are also many tests which are rolling their own curlExec() in order to accomplish this goal.

Proposed resolution

Make sure all tests have a consistent way to use the Mink client's guzzle client. See HistoryTest::getHttpClient() for an example of how this might work. http://cgit.drupalcode.org/drupal/tree/core/modules/history/tests/src/Fu...

Then tests can perform POST or other requests as needed using the client.

Remaining tasks

Add a change record about drupalPost(), drupalPostAjaxForm(), etc. conversions.

Follow-up to make existing tests consistent in their use of getHttpClient().

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

8.5 ⚰️

Component
Simpletest 

Last updated about 2 months ago

Created by

🇺🇸United States mile23 Seattle, WA

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

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