From 6a2c768b479dd320cf38699516fe84e33c8a6c72 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 27 Oct 2022 15:21:47 +0000 Subject: [PATCH] Tests: Move `wp_mail()` tests to the `pluggable` directory. This aims to bring some consistency with other pluggable function tests. Includes moving the `@covers` tag from a single test method to the class DocBlock. Follow-up to [221/tests], [909/tests], [54529]. See #56793. git-svn-id: https://develop.svn.wordpress.org/trunk@54702 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/{mail.php => pluggable/wpMail.php} | 9 ++++++--- tests/phpunit/tests/pluggable/wpRand.php | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) rename tests/phpunit/tests/{mail.php => pluggable/wpMail.php} (99%) diff --git a/tests/phpunit/tests/mail.php b/tests/phpunit/tests/pluggable/wpMail.php similarity index 99% rename from tests/phpunit/tests/mail.php rename to tests/phpunit/tests/pluggable/wpMail.php index 53eacbd7f5..bbe27bd88e 100644 --- a/tests/phpunit/tests/mail.php +++ b/tests/phpunit/tests/pluggable/wpMail.php @@ -2,8 +2,10 @@ /** * @group pluggable * @group mail + * + * @covers ::wp_mail */ -class Tests_Mail extends WP_UnitTestCase { +class Tests_Pluggable_wpMail extends WP_UnitTestCase { public function set_up() { parent::set_up(); reset_phpmailer_instance(); @@ -478,17 +480,18 @@ class Tests_Mail extends WP_UnitTestCase { /** * Tests that AltBody is reset between each wp_mail call. - * - * @covers :wp_mail */ public function test_wp_mail_resets_properties() { $wp_mail_set_text_message = function ( $phpmailer ) { $phpmailer->AltBody = 'user1'; }; + add_action( 'phpmailer_init', $wp_mail_set_text_message ); wp_mail( 'user1@example.localhost', 'Test 1', '

demo

', 'Content-Type: text/html' ); remove_action( 'phpmailer_init', $wp_mail_set_text_message ); + wp_mail( 'user2@example.localhost', 'Test 2', 'test2' ); + $phpmailer = $GLOBALS['phpmailer']; $this->assertNotSame( 'user1', $phpmailer->AltBody ); } diff --git a/tests/phpunit/tests/pluggable/wpRand.php b/tests/phpunit/tests/pluggable/wpRand.php index e7ef3b2725..9fcfa8bde1 100644 --- a/tests/phpunit/tests/pluggable/wpRand.php +++ b/tests/phpunit/tests/pluggable/wpRand.php @@ -2,6 +2,7 @@ /** * @group pluggable + * * @covers ::wp_rand */ class Tests_Pluggable_wpRand extends WP_UnitTestCase {