Make WordPress Core

Changeset 61370


Ignore:
Timestamp:
12/11/2025 11:47:08 PM (2 weeks ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSame() in some newly introduced 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 [60775], [61131].

See #64324.

Location:
trunk/tests/phpunit/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/menu/wpAjaxMenuQuickSearch.php

    r60991 r61370  
    193193
    194194        $results_json = array_map( 'json_decode', $results );
    195         $this->assertEquals( 'wptests_123', $results_json[0]->post_type );
     195        $this->assertSame( 'wptests_123', $results_json[0]->post_type );
    196196    }
    197197}
  • trunk/tests/phpunit/tests/pluggable/wpMail.php

    r61352 r61370  
    667667
    668668        $mailer = tests_retrieve_phpmailer_instance();
    669         $this->assertEquals( 'quoted-printable', $mailer->Encoding );
     669        $this->assertSame( 'quoted-printable', $mailer->Encoding );
    670670
    671671        wp_mail( WP_TESTS_EMAIL, 'A follow up short email', 'Short email' );
    672672
    673673        $mailer = tests_retrieve_phpmailer_instance();
    674         $this->assertEquals( '7bit', $mailer->Encoding );
     674        $this->assertSame( '7bit', $mailer->Encoding );
    675675    }
    676676
Note: See TracChangeset for help on using the changeset viewer.