Add a test logger channel for test base classes to use

Created on 20 March 2017, over 7 years ago
Updated 8 July 2024, 2 months ago

Problem/Motivation

There doesn't appear to be an easy or consistent way for tests to assert that a message has been logged (via a logger channel, not to the screen).

The workaround is to enable the dblog module for any test needing to assert that a message is logged, but this seems overly complicated.

Proposed resolution

Add a test logger channel for kernel and browser tests, and a method assertLog() to the base classes (via a trait). Since log messages need to persist past page requests (for Browser tests anyway), either the state backend, or a cache backend, can be used to store the logs for the duration of the test.

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Closed: duplicate

Version

9.4

Component
PHPUnit 

Last updated less than a minute ago

Created by

🇺🇸United States jhedstrom Portland, OR

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