Make WordPress Core


Ignore:
Timestamp:
06/04/2024 10:21:11 AM (12 months ago)
Author:
ellatrix
Message:

REST API: Add post class list field.

See https://github.com/WordPress/gutenberg/pull/60642.
See https://github.com/WordPress/wordpress-develop/pull/6716.

Fixes #61360.

Props antonvlasenko, timothyblynjacobs, ellatrix, oandregal.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php

    r58097 r58326  
    760760        }
    761761
     762        $datetime_keys = array( 'date', 'date_gmt', 'modified', 'modified_gmt' );
     763
    762764        foreach ( $data as $key => $value ) {
    763             if ( is_string( $value ) && (
    764                 'date' === $key ||
    765                 'date_gmt' === $key ||
    766                 'modified' === $key ||
    767                 'modified_gmt' === $key
    768             ) ) {
    769                 $data[ $key ] = '2017-02-14T00:00:00';
    770             } else {
    771                 $data[ $key ] = $this->normalize_fixture( $value, "$path.$key" );
     765            if ( is_string( $value ) ) {
     766                if ( in_array( $key, $datetime_keys, true ) ) {
     767                    $data[ $key ] = '2017-02-14T00:00:00';
     768                    continue;
     769                }
     770
     771                if ( 1 === preg_match( '/^post-\d+$/', $value ) ) {
     772                    // Normalize the class value to ensure test stability.
     773                    $data[ $key ] = 'post-1073';
     774                    continue;
     775                }
    772776            }
     777
     778            $data[ $key ] = $this->normalize_fixture( $value, "$path.$key" );
    773779        }
    774780
Note: See TracChangeset for help on using the changeset viewer.