Skip to content

Commit 9aac91b

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@61370 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 63b3a8f commit 9aac91b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tests/phpunit/tests/menu/wpAjaxMenuQuickSearch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,6 @@ public function test_search_returns_post_types_with_numeric_slugs() {
192192
$this->assertCount( 1, $results );
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
}

tests/phpunit/tests/pluggable/wpMail.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,12 +666,12 @@ public function test_wp_mail_encoding_does_not_bleed() {
666666
wp_mail( WP_TESTS_EMAIL, 'Looong line testing', $content );
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

677677
/**

0 commit comments

Comments
 (0)