Make WordPress Core

Changeset 57706


Ignore:
Timestamp:
02/25/2024 03:25:49 PM (7 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertSame() in new_admin_email_subject filter test.

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 [57283].

See #59655.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/admin/includesMisc.php

    r57283 r57706  
    3333     */
    3434    public function test_new_admin_email_subject_filter() {
    35         // Default value
     35        // Default value.
    3636        $mailer = tests_retrieve_phpmailer_instance();
    3737        update_option_new_admin_email( 'old@example.com', 'new@example.com' );
    38         $this->assertEquals( '[Test Blog] New Admin Email Address', $mailer->get_sent()->subject );
     38        $this->assertSame( '[Test Blog] New Admin Email Address', $mailer->get_sent()->subject );
    3939
    40         // Filtered value
     40        // Filtered value.
    4141        add_filter(
    4242            'new_admin_email_subject',
     
    5252        $mailer = tests_retrieve_phpmailer_instance();
    5353        update_option_new_admin_email( 'old@example.com', 'new@example.com' );
    54         $this->assertEquals( 'Filtered Admin Email Address', $mailer->get_sent()->subject );
     54        $this->assertSame( 'Filtered Admin Email Address', $mailer->get_sent()->subject );
    5555    }
    5656}
Note: See TracChangeset for help on using the changeset viewer.