Make WordPress Core


Ignore:
Timestamp:
09/25/2026 03:31:07 PM (5 days ago)
Author:
lancewillett
Message:

Tests: Replace native assertions in PHPUnit test classes.

Use PHPUnit type assertions in test setup and helpers so checks remain active when native PHP assertions are disabled and report failures through PHPUnit.

Retain native assertions outside PHPUnit test classes and add messages describing their invariants.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/13651

Props soean.
See #64895.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpstan/GlobalDocBlockVisitor.php

    r62642 r63936  
    166166                        foreach ( $matches as $match ) {
    167167                                $type = preg_replace( '/\s+/', '', $match['type'] );
    168                                 assert( is_string( $type ) && '' !== $type );
     168                                assert( is_string( $type ) && '' !== $type, 'Collapsing whitespace in a non-empty type must yield a non-empty string.' );
    169169                                $map[ $match['variable'] ] = $type;
    170170                        }
Note: See TracChangeset for help on using the changeset viewer.