[meta] Replace assertions with more appropriate ones

Created on 17 April 2020, over 5 years ago
Updated 22 January 2024, over 1 year ago

Problem/Motivation

Wherever possible, use specific PHPUnit default assertions, that also provide standard messaging in case of assertion failure. PHPUnit's list @ https://phpunit.readthedocs.io/en/8.5/assertions.html is the best starting point to understand what default PHPUnit provides.

However, beware of PHPUnit's own deprecations -- the most accurate list is PHPUnit 9 at the moment, https://phpunit.readthedocs.io/en/9.1/assertions.html. Drupal does not support PHPUnit 9 yet, but has already removed usage of methods deprecated in PHPUnit 8 in #3110543: [meta] Support PHPUnit 9 in Drupal 9 .

For example: assertSame(*, count()) can be replaced by assertCount().

Issues open:

Done:

Proposed resolution

Add child issues for each case and replace them.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🌱 Plan
Status

Fixed

Version

11.0 🔥

Component
PHPUnit 

Last updated about 1 hour ago

Created by

🇨🇳China jungle Chongqing, China

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