WordPress.org

Make WordPress Core

Ticket #40810: 40810.2.patch

File 40810.2.patch, 806 bytes (added by pessoft, 2 years ago)

Unittest to verify that phpmailer instance From field is updated by wp_cron

  • tests/phpunit/tests/mail.php

     
    362362        }
    363363
    364364        /**
     365         * Test that the From parameter has been set in phpmailer instance and not kept default.
     366         * Even in the case when SERVER_NAME is not available.
     367         *
     368         * @ticket 40810
     369         */
     370        public function test_wp_mail_from_not_default() {
     371                $_SERVER['SERVER_NAME'] = '';
     372                wp_mail( 'user@example.org', 'Testing the From field', 'The From field should not be default.' );
     373
     374                $mailer = tests_retrieve_phpmailer_instance();
     375
     376                $this->assertNotEquals( 'root@localhost', $mailer->From );
     377        }
     378
     379        /**
    365380         * @ticket 35598
    366381         */
    367382        public function test_phpmailer_exception_thrown() {