Skip to content

Commit

Permalink
Tests: Use assertSame() in `WP_REST_Global_Styles_Revisions_Control…
Browse files Browse the repository at this point in the history
…ler` 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@58673 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Jul 4, 2024
1 parent 922949f commit 70bad67
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,12 @@ protected function check_get_revision_response( $response_revision_item, $revisi

// Global styles.
$config = ( new WP_Theme_JSON( json_decode( $revision_expected_item->post_content, true ), 'custom' ) )->get_raw_data();
$this->assertEquals(
$this->assertSame(
$config['settings'],
$response_revision_item['settings'],
'Check that the revision settings exist in the response.'
);
$this->assertEquals(
$this->assertSame(
$config['styles'],
$response_revision_item['styles'],
'Check that the revision styles match the updated styles.'
Expand Down Expand Up @@ -371,7 +371,7 @@ public function test_get_items_eligible_roles() {
$data = $response->get_data();

$this->assertCount( $this->total_revisions + 1, $data, 'Check that extra revision exist' );
$this->assertEquals( self::$second_admin_id, $data[0]['author'], 'Check that second author id returns expected value.' );
$this->assertSame( self::$second_admin_id, $data[0]['author'], 'Check that second author id returns expected value.' );
}

/**
Expand Down

0 comments on commit 70bad67

Please sign in to comment.