Make WordPress Core

Changeset 58673

Timestamp:
07/04/2024 03:09:15 PM (5 weeks ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSame() in WP_REST_Global_Styles_Revisions_Controller tests.

This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using assertSame() should generally be preferred to assertEquals() where appropriate, to make the tests more reliable.

Follow-up to [56082].

See #61573.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-global-styles-revisions-controller.php

    r58225 r58673  
    273273        // Global styles.
    274274        $config = ( new WP_Theme_JSON( json_decode( $revision_expected_item->post_content, true ), 'custom' ) )->get_raw_data();
    275         $this->assertEquals(
     275        $this->assert(
    276276            $config['settings'],
    277277            $response_revision_item['settings'],
    278278            'Check that the revision settings exist in the response.'
    279279        );
    280         $this->assertEquals(
     280        $this->assert(
    281281            $config['styles'],
    282282            $response_revision_item['styles'],
     
    372372
    373373        $this->assertCount( $this->total_revisions + 1, $data, 'Check that extra revision exist' );
    374         $this->assertEquals( self::$second_admin_id, $data[0]['author'], 'Check that second author id returns expected value.' );
     374        $this->assert( self::$second_admin_id, $data[0]['author'], 'Check that second author id returns expected value.' );
    375375    }
    376376
Note: See TracChangeset for help on using the changeset viewer.