Make WordPress Core

Ticket #35598: 35598.3.diff

File 35598.3.diff, 2.0 KB (added by Kau-Boy, 6 years ago)

updating the WP_Error comment

  • src/wp-includes/pluggable.php

     
    486486                 *
    487487                 * @since 4.4.0
    488488                 *
    489                  * @param WP_Error $error A WP_Error object with the phpmailerException code, message, and an array
     489                 * @param WP_Error $error A WP_Error object with the phpmailerException message, and an array
    490490                 *                        containing the mail recipient, subject, message, headers, and attachments.
    491491                 */
    492                 do_action( 'wp_mail_failed', new WP_Error( $e->getCode(), $e->getMessage(), $mail_error_data ) );
     492                do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_error_data ) );
    493493
    494494                return false;
    495495        }
  • tests/phpunit/includes/bootstrap.php

     
    4949
    5050// Override the PHPMailer
    5151require_once( dirname( __FILE__ ) . '/mock-mailer.php' );
    52 $phpmailer = new MockPHPMailer();
     52$phpmailer = new MockPHPMailer( true );
    5353
    5454system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg( $config_file_path ) . ' ' . $multisite );
    5555
  • tests/phpunit/tests/mail.php

     
    307307
    308308                $this->assertNotContains( 'quoted-printable', $GLOBALS['phpmailer']->mock_sent[0]['header'] );
    309309        }
     310
     311        /**
     312         * @ticket 35598
     313         */
     314        public function test_phpmailer_exception_thrown() {
     315                $to       = 'an_invalid_address';
     316                $subject  = 'Testing';
     317                $message  = 'Test Message';
     318
     319                $ma = new MockAction();
     320                add_action( 'wp_mail_failed', array( &$ma, 'action' ) );
     321
     322                wp_mail( $to, $subject, $message );
     323                $this->assertEquals( 1, $ma->get_call_count() );
     324        }
    310325}