Add drupalGet() to KernelTestBase

Created on 27 September 2023, 9 months ago
Updated 29 September 2023, 9 months ago

Problem/Motivation

Kernel tests are significantly faster than browser tests (see 🌱 [META] Convert some tests into Kernel or Unit tests Active ).

Many browser tests only need to check something in the returned content of a controller. This can actually be done in a Kernel test with a few tweaks.

This would allow more tests to be converted to kernel tests.

Steps to reproduce

Proposed resolution

Add a drupalGet() method to KernelTestBase. This should output HTML files for debugging in the same way that BrowserTestBase does.

Working-but-in-need-of-clean-up code is here:

- Add code from https://github.com/mglaman/drupal-test-helpers/tree/main/src to KernelTestBase
- https://github.com/mglaman/drupal-test-helpers/commit/2dbed403a1872a3aea...
- https://git.drupalcode.org/project/layout_paragraphs/-/merge_requests/12...

Code added to KernelTestBase should avoid duplicating code in BrowserTestBase -- this may require code being refactored from UiHelperTrait to a new trait.

Also to consider (for naming of traits, refactoring choices etc) is that as a follow-up, submitForm() should be made available to KernelTestBase as well.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Active

Version

11.0 🔥

Component
PHPUnit 

Last updated about 11 hours ago

Created by

🇬🇧United Kingdom joachim

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

Comments & Activities

Production build 0.69.0 2024