BrowserHtmlDebugTrait::htmlOutput() should format JSON

Created on 4 June 2024, 3 months ago
Updated 17 July 2024, about 2 months ago

Problem/Motivation

When a functional test outputs the HTML response for a JSONAPI response (or any other JSON), the JSON is all one long string which is hard to read.

It would be nice if this were formatted in a human-readable way.

Steps to reproduce

Proposed resolution

Not sure how to do this.

The $message parameter isn't only JSON, it has a prefix that is text, so we can't do something hacky like json_encode(json_decode(), JSON_PRETTY_PRINT).

I was wondering about adding an HTTP middleware in tests to do this https://ourcodeworld.com/articles/read/1120/how-to-pretty-print-a-jsonre... for JSON responses, but JSONAPI module for one isn't using Symfony JSON responses AFAICT.

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.71.5 2024