Changeset 39086 for trunk/tests/phpunit/tests/mail.php
- Timestamp:
- 11/02/2016 04:26:18 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/mail.php
r38286 r39086 361 361 $this->assertEquals( '', $mailer->Sender ); 362 362 } 363 364 /** 365 * @ticket 35598 366 */ 367 public function test_phpmailer_exception_thrown() { 368 $to = 'an_invalid_address'; 369 $subject = 'Testing'; 370 $message = 'Test Message'; 371 372 $ma = new MockAction(); 373 add_action( 'wp_mail_failed', array( &$ma, 'action' ) ); 374 375 wp_mail( $to, $subject, $message ); 376 377 $this->assertEquals( 1, $ma->get_call_count() ); 378 379 $expected_error_data = array( 380 'to' => array( 'an_invalid_address' ), 381 'subject' => 'Testing', 382 'message' => 'Test Message', 383 'headers' => array(), 384 'attachments' => array(), 385 'phpmailer_exception_code' => 2, 386 ); 387 388 //Retrieve the arguments passed to the 'wp_mail_failed' hook callbacks 389 $all_args = $ma->get_args(); 390 $call_args = array_pop( $all_args ); 391 392 $this->assertEquals( 'wp_mail_failed', $call_args[0]->get_error_code() ); 393 $this->assertEquals( $expected_error_data, $call_args[0]->get_error_data() ); 394 } 363 395 }
Note: See TracChangeset
for help on using the changeset viewer.