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
This commit is contained in:
Sergey Biryukov 2022-10-27 15:21:47 +00:00
parent de38bf25bb
commit 6a2c768b47
2 changed files with 7 additions and 3 deletions

View File

@ -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', '<p>demo</p>', '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 );
}

View File

@ -2,6 +2,7 @@
/**
* @group pluggable
*
* @covers ::wp_rand
*/
class Tests_Pluggable_wpRand extends WP_UnitTestCase {