drupal_render() and drupal_render_root() are deprecated global functions. Classes often have to wrap these functions, or a call to get the renderer service, for testing purposes when the service isn't part of the container. This creates duplicate code in core, and a a goal of adding more test coverage means more classes will need to mock the render.

A trait should be introduce that does this, so it can be added as needed.

Comments

mpdonadio’s picture

I will work on this, and get a proper summary create. I mainly wanted to have an issue to reference.

dawehner’s picture

Ideally we would inject the service if possible.

dawehner’s picture

Status: Active » Closed (won't fix)

Yeah I think a trait is not a solution we want.

mpdonadio’s picture

Assigned: mpdonadio » Unassigned