Make WordPress Core

Ticket #37736: 37736-test.diff

File 37736-test.diff, 932 bytes (added by iandunn, 8 years ago)
  • tests/phpunit/tests/mail.php

    diff --git tests/phpunit/tests/mail.php tests/phpunit/tests/mail.php
    index 9f9dd01..3a5b3ba 100644
    class Tests_Mail extends WP_UnitTestCase { 
    342342                        $this->assertEquals( $expected[ $header ], array_pop( $target_headers ) );
    343343                }
    344344        }
     345
     346        /**
     347         * Test that the Sender field in the SMTP envelope is not set by Core
     348         *
     349         * Correctly setting the Sender requires knowledge that is not available to Core. An incorrect value will
     350         * often lead to messages being rejected by the receiving MTA, so it's the admin's responsibility to
     351         * set it correctly.
     352         *
     353         * @ticket 37736
     354         */
     355        public function test_wp_mail_sender_not_set() {
     356                wp_mail( 'user@example.org', 'Testing the Sender field', 'The Sender field should not have been set.' );
     357
     358                $mailer = tests_retrieve_phpmailer_instance();
     359
     360                $this->assertEquals( '', $mailer->Sender );
     361        }
    345362}