Make WordPress Core


Ignore:
Timestamp:
09/22/2026 11:20:03 PM (7 weeks ago)
Author:
lancewillett
Message:

Tests: Use strict assertions in top-level test files.

Normalize expected IDs to match the string or integer values returned by comment, taxonomy, term, and user APIs. Use strict REST API comparisons and correct the fractional-hour date fixture to expect an integer timestamp.

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

Props haritpanchal, desrosj.
See #64895.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/taxonomy.php

    r62761 r63882  
    392392                $posts_with_terms = array_merge( $posts_with_tag, $posts_with_category );
    393393
    394                 $this->assertEquals( $posts_with_tag, get_objects_in_term( $tag_id, 'post_tag' ) );
    395                 $this->assertEquals( $posts_with_category, get_objects_in_term( $cat_id, 'category' ) );
    396                 $this->assertEquals( $posts_with_terms, get_objects_in_term( array( $tag_id, $cat_id ), array( 'post_tag', 'category' ) ) );
    397                 $this->assertEquals( array_reverse( $posts_with_tag ), get_objects_in_term( $tag_id, 'post_tag', array( 'order' => 'desc' ) ) );
     394                $this->assertSame( array_map( 'strval', $posts_with_tag ), get_objects_in_term( $tag_id, 'post_tag' ) );
     395                $this->assertSame( array_map( 'strval', $posts_with_category ), get_objects_in_term( $cat_id, 'category' ) );
     396                $this->assertSame( array_map( 'strval', $posts_with_terms ), get_objects_in_term( array( $tag_id, $cat_id ), array( 'post_tag', 'category' ) ) );
     397                $this->assertSame( array_map( 'strval', array_reverse( $posts_with_tag ) ), get_objects_in_term( $tag_id, 'post_tag', array( 'order' => 'desc' ) ) );
    398398        }
    399399
Note: See TracChangeset for help on using the changeset viewer.