Add a PHPUnit assertion that an entity is valid

Created on 2 March 2022, almost 3 years ago
Updated 13 September 2024, 3 months ago

Problem/Motivation

Validating an entity is non-trivial:

    $violations = $time_period->validate();
    $this->assertEqual(count($violations), 0);

If $violations is non-empty, you have to dump() them to see what the problem is.

Steps to reproduce

Proposed resolution

Add an assertEntityValid() method available to Kernel and Functional test types.

This should pass if the entity has no validation violations, and output the violation messages otherwise.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

✨ Feature request
Status

Needs work

Version

11.0 🔥

Component
PHPUnit  →

Last updated about 3 hours ago

Created by

🇬🇧United Kingdom joachim

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

Merge Requests

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