Make WordPress Core

Changeset 61529


Ignore:
Timestamp:
01/26/2026 04:18:46 PM (3 days ago)
Author:
jonsurrell
Message:

Block Processor: Remove use of NumberFormatter from test suite.

The Block Processor tests call NumberFormatter for generating its error messages, but in environments lacking the intl extension this led to crashes while running the tests.

This patch reworks the tests so that they avoid calling NumberFormatter so that the tests run on more diverse setups.

Developed in https://github.com/WordPress/wordpress-develop/pull/10576
Discussed in https://core.trac.wordpress.org/ticket/64329

Follow-up to [60939].

Reviewed by jonsurrell, jorbin.
Merges [61342] to the 6.9 branch.

Props desrosj, ellatrix, peterwilsoncc, westonruter.

Fixes #64329.

Location:
branches/6.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.9

  • branches/6.9/tests/phpunit/tests/block-processor/wpBlockProcessor-BlockProcessing.php

    r61296 r61529  
    5050
    5151        $processor = new WP_Block_Processor( $html );
    52         $n         = new NumberFormatter( 'en-US', NumberFormatter::ORDINAL );
    5352
    5453        for ( $i = 0; $i < $max_depth; $i++ ) {
     54            $nth = $i + 1;
     55
    5556            $this->assertTrue(
    5657                $processor->next_delimiter(),
    57                 "Should have found {$n->format( $i + 1 )} opening delimiter: check test setup."
     58                "Should have found opening delimiter #{$nth}: check test setup."
    5859            );
    5960
     
    6162                $i + 1,
    6263                $processor->get_depth(),
    63                 "Should have identified the proper depth of the {$n->format( $i + 1 )} opening delimiter."
     64                "Should have identified the proper depth of opening delimiter #{$nth}."
    6465            );
    6566        }
    6667
    6768        for ( $i = 0; $i < $max_depth; $i++ ) {
     69            $nth = $i + 1;
     70
    6871            $this->assertTrue(
    6972                $processor->next_delimiter(),
    70                 "Should have found {$n->format( $i + 1 )} closing delimiter: check test setup."
     73                "Should have found closing delimiter #{$nth}: check test setup."
    7174            );
    7275
     
    7477                $max_depth - $i - 1,
    7578                $processor->get_depth(),
    76                 "Should have identified the proper depth of the {$n->format( $i + 1 )} closing delimiter."
     79                "Should have identified the proper depth of closing delimiter #{$nth}."
    7780            );
    7881        }
Note: See TracChangeset for help on using the changeset viewer.